summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert non-address taken functions with C calling conventions to fastcc.Chris Lattner2005-05-081-1/+41
| | | | llvm-svn: 21791
* Implement Reassociate/mul-neg-add.llChris Lattner2005-05-081-0/+12
| | | | llvm-svn: 21788
* Bail out earlierChris Lattner2005-05-081-4/+4
| | | | llvm-svn: 21786
* Teach reassociate that 0-X === X*-1Chris Lattner2005-05-081-4/+46
| | | | llvm-svn: 21785
* Fix PR557 and basictest[34].ll.Chris Lattner2005-05-081-12/+27
| | | | | | | | This makes reassociate realize that loads should be treated as unmovable, and gives distinct ranks to distinct values defined in the same basic block, allowing reassociate to do its thing. llvm-svn: 21783
* Add debugging informationChris Lattner2005-05-081-0/+18
| | | | llvm-svn: 21781
* eliminate gotosChris Lattner2005-05-081-3/+4
| | | | llvm-svn: 21780
* Improve reassociation handling of inverses, implementing inverses.ll.Chris Lattner2005-05-081-2/+104
| | | | llvm-svn: 21778
* clean up and modernize this pass.Chris Lattner2005-05-081-24/+18
| | | | llvm-svn: 21776
* Strength reduce SAR into SHR if there is no way sign bits could be shiftedChris Lattner2005-05-081-0/+10
| | | | | | | | | | | in. This tends to get cases like this: X = cast ubyte to int Y = shr int X, ... Tested by: shift.ll:test24 llvm-svn: 21775
* Refactor some codeChris Lattner2005-05-081-45/+55
| | | | llvm-svn: 21772
* Handle some simple cases where we can see that values get annihilated.Chris Lattner2005-05-081-7/+42
| | | | llvm-svn: 21771
* Fix a miscompilation of crafty by clobbering the "A" variable.Chris Lattner2005-05-071-9/+10
| | | | llvm-svn: 21770
* Rewrite the guts of the reassociate pass to be more efficient and logical. ↵Chris Lattner2005-05-071-103/+185
| | | | | | | | | Instead of trying to do local reassociation tweaks at each level, only process an expression tree once (at its root). This does not improve the reassociation pass in any real way. llvm-svn: 21768
* * Add two strlen optimizations:Reid Spencer2005-05-071-23/+56
| | | | | | | | | | | | strlen(x) != 0 -> *x != 0 strlen(x) == 0 -> *x == 0 * Change nested statistics to use style of other LLVM statistics so that only the name of the optimization (simplify-libcalls) is used as the statistic name, and the description indicates which specific all is optimized. Cuts down on some redundancy and saves a few bytes of space. * Make note of stpcpy optimization that could be done. llvm-svn: 21766
* Don't increment the counter unless the debug flag is set.Reid Spencer2005-05-071-1/+1
| | | | llvm-svn: 21762
* Convert shifts to muls to assist reassociation. This implementsChris Lattner2005-05-071-2/+27
| | | | | | Reassociate/shifttest.ll llvm-svn: 21761
* Simplify the code and rearrange it. No major functionality changes here.Chris Lattner2005-05-071-62/+82
| | | | llvm-svn: 21759
* BAD typeo which caused many testsuite failures last night. Note to self, doChris Lattner2005-05-061-1/+1
| | | | | | not change code after testing it without retesting! llvm-svn: 21741
* Preserve tail markerChris Lattner2005-05-063-4/+7
| | | | llvm-svn: 21737
* Implement Transforms/Inline/inline-tail.llChris Lattner2005-05-061-1/+16
| | | | llvm-svn: 21736
* preserve the tail markerChris Lattner2005-05-063-0/+6
| | | | llvm-svn: 21734
* Wrap long linesChris Lattner2005-05-061-6/+10
| | | | llvm-svn: 21720
* DCE intrinsic instructions without side effects.Chris Lattner2005-05-061-1/+20
| | | | llvm-svn: 21719
* Teach instcombine propagate zeroness through shl instructions, implementingChris Lattner2005-05-061-8/+4
| | | | | | and.ll:test31 llvm-svn: 21717
* Implement shift.ll:test23. If we are shifting right then immediately truncatingChris Lattner2005-05-061-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the result, turn signed shift rights into unsigned shift rights if possible. This leads to later simplification and happens *often* in 176.gcc. For example, this testcase: struct xxx { unsigned int code : 8; }; enum codes { A, B, C, D, E, F }; int foo(struct xxx *P) { if ((enum codes)P->code == A) bar(); } used to be compiled to: int %foo(%struct.xxx* %P) { %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0 ; <uint*> [#uses=1] %tmp.2 = load uint* %tmp.1 ; <uint> [#uses=1] %tmp.3 = cast uint %tmp.2 to int ; <int> [#uses=1] %tmp.4 = shl int %tmp.3, ubyte 24 ; <int> [#uses=1] %tmp.5 = shr int %tmp.4, ubyte 24 ; <int> [#uses=1] %tmp.6 = cast int %tmp.5 to sbyte ; <sbyte> [#uses=1] %tmp.8 = seteq sbyte %tmp.6, 0 ; <bool> [#uses=1] br bool %tmp.8, label %then, label %UnifiedReturnBlock Now it is compiled to: %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0 ; <uint*> [#uses=1] %tmp.2 = load uint* %tmp.1 ; <uint> [#uses=1] %tmp.2 = cast uint %tmp.2 to sbyte ; <sbyte> [#uses=1] %tmp.8 = seteq sbyte %tmp.2, 0 ; <bool> [#uses=1] br bool %tmp.8, label %then, label %UnifiedReturnBlock which is the difference between this: foo: subl $4, %esp movl 8(%esp), %eax movl (%eax), %eax shll $24, %eax sarl $24, %eax testb %al, %al jne .LBBfoo_2 and this: foo: subl $4, %esp movl 8(%esp), %eax movl (%eax), %eax testb %al, %al jne .LBBfoo_2 This occurs 3243 times total in the External tests, 215x in povray, 6x in each f2c'd program, 1451x in 176.gcc, 7x in crafty, 20x in perl, 25x in gap, 3x in m88ksim, 25x in ijpeg. Maybe this will cause a little jump on gcc tommorow :) llvm-svn: 21715
* Implement xor.ll:test22Chris Lattner2005-05-061-0/+9
| | | | llvm-svn: 21713
* implement and.ll:test30 and set.ll:test21Chris Lattner2005-05-061-18/+60
| | | | llvm-svn: 21712
* implement or.ll:test20Chris Lattner2005-05-061-0/+7
| | | | llvm-svn: 21709
* Fix a bug compimling Ruby, fixing this testcase:Chris Lattner2005-05-051-3/+11
| | | | | | LowerSetJmp/2005-05-05-OldUses.ll llvm-svn: 21696
* Instcombine: cast (X != 0) to int, cast (X == 1) to int -> X iff X has only ↵Chris Lattner2005-05-041-3/+25
| | | | | | | | | | | | | | | | | | | | | | the low bit set. This implements set.ll:test20. This triggers 2x on povray, 9x on mesa, 11x on gcc, 2x on crafty, 1x on eon, 6x on perlbmk and 11x on m88ksim. It allows us to compile these two functions into the same code: struct s { unsigned int bit : 1; }; unsigned foo(struct s *p) { if (p->bit) return 1; else return 0; } unsigned bar(struct s *p) { return p->bit; } llvm-svn: 21690
* Implement the IsDigitOptimization for simplifying calls to the isdigitReid Spencer2005-05-041-6/+54
| | | | | | | | | | | | | library function: isdigit(chr) -> 0 or 1 if chr is constant isdigit(chr) -> chr - '0' <= 9 otherwise Although there are many calls to isdigit in llvm-test, most of them are compiled away by macros leaving only this: 2 MultiSource/Applications/hexxagon llvm-svn: 21688
* * Correct the function prototypes for some of the functions to match theReid Spencer2005-05-041-9/+172
| | | | | | | | | | | | | | | | | | | | | | actual spec (int -> uint) * Add the ability to get/cache the strlen function prototype. * Make sure generated values are appropriately named for debugging purposes * Add the SPrintFOptimiation for 4 casts of sprintf optimization: sprintf(str,cstr) -> llvm.memcpy(str,cstr) (if cstr has no %) sprintf(str,"") -> store sbyte 0, str sprintf(str,"%s",src) -> llvm.memcpy(str,src) (if src is constant) sprintf(str,"%c",chr) -> store chr, str ; store sbyte 0, str+1 The sprintf optimization didn't fire as much as I had hoped: 2 MultiSource/Applications/SPASS 5 MultiSource/Benchmarks/McCat/18-imp 22 MultiSource/Benchmarks/Prolangs-C/TimberWolfMC 1 MultiSource/Benchmarks/Prolangs-C/assembler 6 MultiSource/Benchmarks/Prolangs-C/unix-smail 2 MultiSource/Benchmarks/mediabench/mpeg2/mpeg2dec llvm-svn: 21679
* Implement optimizations for the strchr and llvm.memset library calls.Reid Spencer2005-05-031-21/+232
| | | | | | | | | | | | | | | Neither of these activated as many times as was hoped: strchr: 9 MultiSource/Applications/siod 1 MultiSource/Applications/d 2 MultiSource/Prolangs-C/archie-client 1 External/SPEC/CINT2000/176.gcc/176.gcc llvm.memset: no hits llvm-svn: 21669
* Avoid garbage output in the statistics display by ensuring that theReid Spencer2005-05-031-18/+34
| | | | | | | | strings passed to Statistic's constructor are not destructable. The stats are printed during static destruction and the SimplifyLibCalls module was getting destructed before the statistics. llvm-svn: 21661
* Add the StrNCmpOptimization which is similar to strcmp.Reid Spencer2005-05-031-13/+101
| | | | | | Unfortunately, this optimization didn't trigger on any llvm-test tests. llvm-svn: 21660
* Implement the fprintf optimization which converts calls like this:Reid Spencer2005-05-021-7/+126
| | | | | | | | | | | | | | | | fprintf(F,"hello") -> fwrite("hello",strlen("hello"),1,F) fprintf(F,"%s","hello") -> fwrite("hello",strlen("hello"),1,F) fprintf(F,"%c",'x') -> fputc('c',F) This optimization fires severals times in llvm-test: 313 MultiSource/Applications/Burg 302 MultiSource/Benchmarks/Prolangs-C/TimberWolfMC 189 MultiSource/Benchmarks/Prolangs-C/mybison 175 MultiSource/Benchmarks/Prolangs-C/football 130 MultiSource/Benchmarks/Prolangs-C/unix-tbl llvm-svn: 21657
* Fixed a comment.John Criswell2005-05-021-3/+3
| | | | llvm-svn: 21653
* Implement getelementptr.ll:test11Chris Lattner2005-05-011-0/+16
| | | | llvm-svn: 21647
* Check for volatile loads only once.Chris Lattner2005-05-011-9/+35
| | | | | | Implement load.ll:test7 llvm-svn: 21645
* Fix a comment that stated the wrong thing.Reid Spencer2005-04-301-5/+2
| | | | llvm-svn: 21638
* * Don't depend on "guessing" what a FILE* is, just require that the actualReid Spencer2005-04-301-21/+132
| | | | | | | | | | | | | | | | | | | | type be obtained from a CallInst we're optimizing. * Make it possible for getConstantStringLength to return the ConstantArray that it extracts in case the content is needed by an Optimization. * Implement the strcmp optimization * Implement the toascii optimization This pass is now firing several to many times in the following MultiSource tests: Applications/Burg - 7 (strcat,strcpy) Applications/siod - 13 (strcat,strcpy,strlen) Applications/spiff - 120 (exit,fputs,strcat,strcpy,strlen) Applications/treecc - 66 (exit,fputs,strcat,strcpy) Applications/kimwitu++ - 34 (strcmp,strcpy,strlen) Applications/SPASS - 588 (exit,fputs,strcat,strcpy,strlen) llvm-svn: 21626
* Implement the optimizations for "pow" and "fputs" library calls.Reid Spencer2005-04-291-17/+217
| | | | llvm-svn: 21618
* Remove optimizations that don't require both operands to be constant. TheseReid Spencer2005-04-291-10/+0
| | | | | | are moved to simplify-libcalls pass. llvm-svn: 21614
* Consistently use 'class' to silence VC++Jeff Cohen2005-04-291-2/+4
| | | | llvm-svn: 21612
* * Add constant folding for additional floating point library calls such asReid Spencer2005-04-281-26/+90
| | | | | | | | sinh, cosh, etc. * Make the name comparisons for the fp libcalls a little more efficient by switching on the first character of the name before doing comparisons. llvm-svn: 21611
* Remove from the TODO list those optimizations that are already handled byReid Spencer2005-04-281-29/+1
| | | | | | constant folding implemented in lib/Transforms/Utils/Local.cpp. llvm-svn: 21604
* Document additional libcall transformations that need to be written.Reid Spencer2005-04-281-2/+183
| | | | | | | | Help Wanted! There's a lot of them to write. llvm-svn: 21603
* Doxygenate.Reid Spencer2005-04-271-54/+71
| | | | llvm-svn: 21602
* remove 'statement with no effect' warningChris Lattner2005-04-271-1/+1
| | | | llvm-svn: 21600
OpenPOWER on IntegriCloud