summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Thread comparisons over udiv/sdiv/ashr/lshr exact and lshr nuw/nsw wheneverNick Lewycky2011-03-051-0/+21
| | | | | | | | | possible. This goes into instcombine and instsimplify because instsimplify doesn't need to check hasOneUse since it returns (almost exclusively) constants. This fixes PR9343 #4 #5 and #8! llvm-svn: 127064
* Try once again to optimize "icmp (srem X, Y), Y" by turning the comparison intoNick Lewycky2011-03-051-0/+29
| | | | | | true/false or "icmp slt/sge Y, 0". llvm-svn: 127063
* DenseMap<uintptr_t,...> doesn't allow all values as keys.Jakob Stoklund Olesen2011-03-041-0/+2
| | | | | | | Avoid colliding with the sentinels, hopefully unbreaking llvm-gcc-x86_64-linux-selfhost. llvm-svn: 126982
* Fix typo in comment.Richard Osborne2011-03-031-1/+1
| | | | llvm-svn: 126941
* Optimize fprintf -> iprintf if there are no floating point argumentsRichard Osborne2011-03-031-8/+28
| | | | | | and siprintf is available on the target. llvm-svn: 126940
* Optimize sprintf -> siprintf if there are no floating point argumentsRichard Osborne2011-03-031-8/+28
| | | | | | and siprintf is available on the target. llvm-svn: 126937
* Optimize printf -> iprintf if there are no floating point argumentsRichard Osborne2011-03-031-10/+42
| | | | | | | and iprintf is available on the target. Currently iprintf is only marked as being available on the XCore. llvm-svn: 126935
* Remove some more unused code that I missed.Cameron Zwarich2011-03-021-19/+0
| | | | llvm-svn: 126826
* Eliminate the unused CodeGenPrepare option to split critical edges.Cameron Zwarich2011-03-021-128/+1
| | | | llvm-svn: 126825
* Stop computing the number of uses twice per value in CodeGenPrepare's sinking ofCameron Zwarich2011-03-011-3/+4
| | | | | | | | addressing code. On 403.gcc this almost halves CodeGenPrepare time and reduces total llc time by 9.5%. Unfortunately, getNumUses() is still the hottest function in llc. llvm-svn: 126782
* Make InstCombiner::FoldAndOfICmps create a ConstantRange that's theAnders Carlsson2011-03-011-8/+12
| | | | | | | | | intersection of the LHS and RHS ConstantRanges and return "false" when the range is empty. This simplifies some code and catches some extra cases. llvm-svn: 126744
* Add an obvious missing safety check to DAE::RemoveDeadArgumentsFromCallers.Eli Friedman2011-03-011-1/+1
| | | | llvm-svn: 126720
* Unbreak CMake build.Ted Kremenek2011-02-281-1/+0
| | | | llvm-svn: 126715
* update cmakeChris Lattner2011-02-281-1/+0
| | | | llvm-svn: 126694
* Delete the GEPSplitter experiment.Dan Gohman2011-02-282-84/+0
| | | | llvm-svn: 126671
* Delete the SimplifyHalfPowrLibCalls pass, which was unused, andDan Gohman2011-02-282-161/+0
| | | | | | only existed as the result of a misunderstanding. llvm-svn: 126669
* Teach SimplifyCFG that (switch (select cond, X, Y)) is better expressed as a ↵Frits van Bommel2011-02-281-1/+26
| | | | | | | | branch. Based on a patch by Alistair Lynn. llvm-svn: 126647
* srem doesn't actually have the same resulting sign as its numerator, you couldNick Lewycky2011-02-281-10/+0
| | | | | | | also have a zero when numerator = denominator. Reverts parts of r126635 and r126637. llvm-svn: 126644
* Teach InstCombine to fold "(shr exact X, Y) == 0" --> X == 0, fixing #1 fromNick Lewycky2011-02-281-5/+13
| | | | | | PR9343. llvm-svn: 126643
* The sign of an srem instruction is the sign of its dividend (the firstNick Lewycky2011-02-281-3/+13
| | | | | | | argument), regardless of the divisor. Teach instcombine about this and fix test7 in PR9343! llvm-svn: 126635
* Revert "SimplifyCFG: GEPs with just one non-constant index are also cheap."Benjamin Kramer2011-02-251-5/+3
| | | | | | | Yes, there are other types than i8* and GEPs on them can produce an add+multiply. We don't consider that cheap enough to be speculatively executed. llvm-svn: 126481
* SimplifyCFG: GEPs with just one non-constant index are also cheap.Benjamin Kramer2011-02-241-3/+5
| | | | llvm-svn: 126452
* SimplifyCFG: GEPs with constant indices are cheap enough to be executed ↵Benjamin Kramer2011-02-241-0/+5
| | | | | | unconditionally. llvm-svn: 126445
* Do not use DIFactory. Use DIBuilder.Devang Patel2011-02-241-6/+7
| | | | llvm-svn: 126398
* wire TargetLibraryInfo into simplify libcalls and use it in a couple ofChris Lattner2011-02-241-7/+17
| | | | | | trivial places. This pass needs a lot of work. llvm-svn: 126367
* move a massive amount of code out into its own helper functionChris Lattner2011-02-241-676/+643
| | | | | | to reduce nesting. This needs to be turned into a table. llvm-svn: 126366
* change instcombine to not turn a call to non-varargs bitcast ofChris Lattner2011-02-241-5/+15
| | | | | | | | | function prototype into a call to a varargs prototype. We do allow the xform if we have a definition, but otherwise we don't want to risk that we're changing the abi in a subtle way. On X86-64, for example, varargs require passing stuff in %al. llvm-svn: 126363
* Make LoopDeletion work on loops with multiple edges, as long as the incomingCameron Zwarich2011-02-221-8/+15
| | | | | | values from all of the loop's exiting blocks are equal. Patch by Andrew Clinton. llvm-svn: 126253
* If the phi node was used by an unreachable instruction that ends up usingDuncan Sands2011-02-211-2/+3
| | | | | | | | | | | | itself without going via a phi node then we could return false here in spite of making a change. Also, tweak the comment because this method can (and always could) return true without deleting the original phi node. For example, if the phi node was used by a read-only invoke instruction which is used by another phi node phi2 which is only used by and only uses the invoke, then phi2 would be deleted but not the invoke instruction and not the original phi node. llvm-svn: 126129
* fix a crasher in disabled code (on variable stride loops)Chris Lattner2011-02-211-1/+1
| | | | llvm-svn: 126125
* Simplify RecursivelyDeleteDeadPHINode. The only functionality changeDuncan Sands2011-02-211-28/+16
| | | | | | | | should be that if the phi is used by a side-effect free instruction with no uses then the phi and the instruction now get zapped (checked by the unittest). llvm-svn: 126124
* Add some (disabled code) to print out negative strides.Chris Lattner2011-02-211-3/+15
| | | | llvm-svn: 126102
* Make RecursivelyDeleteDeadPHINode delete a phi node that has no users and add aNick Lewycky2011-02-201-7/+12
| | | | | | | | | test for that. With this change, test/CodeGen/X86/codegen-dce.ll no longer finds any instructions to DCE, so delete the test. Also renamed J and JP to I and IP in RecursivelyDeleteDeadPHINode. llvm-svn: 126088
* Move "A | ~(A & ?) -> -1" from InstCombine to InstructionSimplify.Benjamin Kramer2011-02-201-16/+8
| | | | llvm-svn: 126082
* InstCombine: Add a bunch of combines of the form x | (y ^ z).Benjamin Kramer2011-02-201-0/+41
| | | | | | | | | We usually catch this kind of optimization through InstSimplify's distributive magic, but or doesn't distribute over xor in general. "A | ~(A | B) -> A | ~B" hits 24 times on gcc.c. llvm-svn: 126081
* Teach RecursivelyDeleteDeadPHINodes to handle multiple self-references. PatchNick Lewycky2011-02-201-5/+21
| | | | | | by Andrew Clinton! llvm-svn: 126077
* Instead of keeping two Value*->id# mappings, keep one Value->Value mapping andNick Lewycky2011-02-201-12/+14
| | | | | | | one Value set. This is faster because we only need to use the set when there isn't already an entry in the map. No functionality change! llvm-svn: 126076
* PR9218: SimplifyDemandedVectorElts can return a non-null value that is notEli Friedman2011-02-191-2/+7
| | | | | | | the instruction passed in. Make sure to account for this correctly, instead of looping infinitely. llvm-svn: 126058
* rewrite the memset_pattern pattern generation stuff to accept any 2/4/8/16-byteChris Lattner2011-02-191-32/+12
| | | | | | | | | | | | | | | | | | constant, including globals. This makes us generate much more "pretty" pattern globals as well because it doesn't break it down to an array of bytes all the time. This enables us to handle stores of relocatable globals. This kicks in about 48 times in 254.gap, giving us stuff like this: @.memset_pattern40 = internal constant [2 x %struct.TypHeader* (%struct.TypHeader*, %struct.TypHeader*)*] [%struct.TypHeader* (%struct.TypHeader*, %struct .TypHeader*)* @IsFalse, %struct.TypHeader* (%struct.TypHeader*, %struct.TypHeader*)* @IsFalse], align 16 ... call void @memset_pattern16(i8* %scevgep5859, i8* bitcast ([2 x %struct.TypHeader* (%struct.TypHeader*, %struct.TypHeader*)*]* @.memset_pattern40 to i8* ), i64 %tmp75) nounwind llvm-svn: 126044
* Implement rdar://9009151, transforming strided loop stores ofChris Lattner2011-02-191-32/+125
| | | | | | | | | | | unsplatable values into memset_pattern16 when it is available (recent darwins). This transforms lots of strided loop stores of ints for example, like 5 in vpr: Formed memset: call void @memset_pattern16(i8* %4, i8* getelementptr inbounds ([16 x i8]* @.memset_pattern9, i32 0, i32 0), i64 %tmp25) from store to: {%3,+,4}<%11> at: store i32 3, i32* %scevgep, align 4, !tbaa !4 llvm-svn: 126040
* Make loop-idiom use TargetLibraryInfo to determine whether it is allowedChris Lattner2011-02-181-1/+18
| | | | | | to hack on memset, memcpy etc. llvm-svn: 125974
* Move library stuff out of the toplevel CMakeLists.txt file.Oscar Fuentes2011-02-181-0/+6
| | | | llvm-svn: 125968
* Add some transforms of the kind X-Y>X -> 0>Y which are valid when there is noDuncan Sands2011-02-181-18/+17
| | | | | | overflow. These subsume some existing equality transforms, so zap those. llvm-svn: 125843
* prevent jump threading from merging blocks when their address isChris Lattner2011-02-181-1/+11
| | | | | | | | | | | | | | | | | taken (and used!). This prevents merging the blocks (invalidating the block addresses) in a case like this: #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) void foo() { printf("%p\n", _THIS_IP_); printf("%p\n", _THIS_IP_); printf("%p\n", _THIS_IP_); } which fixes PR4151. llvm-svn: 125829
* Don't unroll loops whose header block's address is taken.Chris Lattner2011-02-181-2/+10
| | | | | | | | | | | | | | | | | This is part of a futile attempt to not "break" bizzaro code like this: l1: printf("l1: %p\n", &&l1); ++x; if( x < 3 ) goto l1; Previously we'd fold &&l1 to 1, which is fine per our semantics but not helpful to the user. llvm-svn: 125827
* have instcombine preserve nsw/nuw/exact when sinkingChris Lattner2011-02-171-11/+53
| | | | | | common operations through a phi. llvm-svn: 125790
* fix typoChris Lattner2011-02-171-1/+1
| | | | llvm-svn: 125787
* fix instcombine merging GEPs through a PHI to only make theChris Lattner2011-02-171-3/+7
| | | | | | result inbounds if all of the inputs are inbounds. llvm-svn: 125785
* add is always integer, thanks to Frits for noticing this.Chris Lattner2011-02-171-1/+1
| | | | llvm-svn: 125774
* Transform "A + B >= A + C" into "B >= C" if the adds do not wrap. Likewise ↵Duncan Sands2011-02-171-93/+106
| | | | | | | | | for some variations (some of these were already present so I unified the code). Spotted by my auto-simplifier as occurring a lot. llvm-svn: 125734
OpenPOWER on IntegriCloud