summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/icmp.ll
Commit message (Collapse)AuthorAgeFilesLines
...
* Tweak this test. We can analyze what happens and show that we still do theNick Lewycky2011-03-071-2/+2
| | | | | | | right thing, instead of merely being unable to analyze and the transform doesn't occur. llvm-svn: 127149
* Add more analysis of the sign bit of an srem instruction. If the LHS is negativeNick Lewycky2011-03-071-0/+19
| | | | | | | then the result could go either way. If it's provably positive then so is the srem. Fixes PR9343 #7! llvm-svn: 127146
* ConstantInt has some getters which return ConstantInt's or ConstantVector's ofNick Lewycky2011-03-061-0/+10
| | | | | | | | the value splatted into every element. Extend this to getTrue and getFalse which by providing new overloads that take Types that are either i1 or <N x i1>. Use it in InstCombine to add vector support to some code, fixing PR8469! llvm-svn: 127116
* Thread comparisons over udiv/sdiv/ashr/lshr exact and lshr nuw/nsw wheneverNick Lewycky2011-03-051-0/+46
| | | | | | | | | 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/+16
| | | | | | true/false or "icmp slt/sge Y, 0". llvm-svn: 127063
* Fold "icmp pred (srem X, Y), Y" like we do for urem. Handle signed comparisonsNick Lewycky2011-03-041-2/+11
| | | | | | | in the urem case, though not the other way around. This is enough to get #3 from PR9343! llvm-svn: 126991
* srem doesn't actually have the same resulting sign as its numerator, you couldNick Lewycky2011-02-281-15/+5
| | | | | | | 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-0/+17
| | | | | | PR9343. llvm-svn: 126643
* The sign of an srem instruction is the sign of its dividend (the firstNick Lewycky2011-02-281-0/+10
| | | | | | | argument), regardless of the divisor. Teach instcombine about this and fix test7 in PR9343! llvm-svn: 126635
* Add some transforms of the kind X-Y>X -> 0>Y which are valid when there is noDuncan Sands2011-02-181-1/+125
| | | | | | overflow. These subsume some existing equality transforms, so zap those. llvm-svn: 125843
* Transform "A + B >= A + C" into "B >= C" if the adds do not wrap. Likewise ↵Duncan Sands2011-02-171-0/+19
| | | | | | | | | 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
* implement the first part of PR8882: when lowering an inboundsChris Lattner2011-02-101-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | gep to explicit addressing, we know that none of the intermediate computation overflows. This could use review: it seems that the shifts certainly wouldn't overflow, but could the intermediate adds overflow if there is a negative index? Previously the testcase would instcombine to: define i1 @test(i64 %i) { %p1.idx.mask = and i64 %i, 4611686018427387903 %cmp = icmp eq i64 %p1.idx.mask, 1000 ret i1 %cmp } now we get: define i1 @test(i64 %i) { %cmp = icmp eq i64 %i, 1000 ret i1 %cmp } llvm-svn: 125271
* merge two tests.Chris Lattner2011-02-091-0/+9
| | | | llvm-svn: 125195
* Fix a random missed optimization by making InstCombine more aggressive when ↵Owen Anderson2011-01-111-0/+17
| | | | | | | | determining which bits are demanded by a comparison against a constant. llvm-svn: 123203
* duncan's spider sense was right, I completely reversed the conditionChris Lattner2010-11-231-4/+4
| | | | | | on this instcombine xform. This fixes a miscompilation of 403.gcc. llvm-svn: 119988
* optimize:Chris Lattner2010-11-211-0/+38
| | | | | | | | | void a(int x) { if (((1<<x)&8)==0) b(); } into "x != 3", which occurs over 100 times in 403.gcc but in no other program in llvm-test. llvm-svn: 119922
* Constant fold x == undef to undef.Dan Gohman2010-06-281-0/+23
| | | | llvm-svn: 107074
* fix incorrect folding of icmp with undef, PR6481.Chris Lattner2010-03-031-1/+11
| | | | llvm-svn: 97659
* fix PR6195, a bug constant folding scalar -> vector compares.Chris Lattner2010-02-011-0/+9
| | | | llvm-svn: 94997
* enhance x-(-A) -> x+A to preserve NUW/NSW.Chris Lattner2009-12-211-0/+13
| | | | | | | | | | | Use the presence of NSW/NUW to fold "icmp (x+cst), x" to a constant in cases where it would otherwise be undefined behavior. Surprisingly (to me at least), this triggers hundreds of the times in a few benchmarks: lencode, ldecode, and 466.h264ref seem to *really* like this. llvm-svn: 91812
* Optimize all cases of "icmp (X+Cst), X" to something simpler. This triggersChris Lattner2009-12-211-0/+37
| | | | | | | a bunch in lencode, ldecod, spass, 176.gcc, 252.eon, among others. It is also the first part of PR5822 llvm-svn: 91811
* convert to filecheckChris Lattner2009-12-211-1/+21
| | | | llvm-svn: 91810
* simplify a transformation by making it more general.Chris Lattner2009-10-111-1/+9
| | | | llvm-svn: 83792
* Use opt -S instead of piping bitcode output through llvm-dis.Dan Gohman2009-09-081-1/+1
| | | | llvm-svn: 81257
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-081-1/+1
| | | | | | of using llvm-as, now that opt supports this. llvm-svn: 81226
* fix PR4837, some bugs folding vector compares. TheseChris Lattner2009-09-021-0/+6
| | | | | | return a vector of i1, not i1 itself. llvm-svn: 80761
* Implement rdar://6480391, extending of equality icmp's to avoid a truncation.Chris Lattner2009-01-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed this in the code compiled for a routine using std::map, which produced this code: %25 = tail call i32 @memcmp(i8* %24, i8* %23, i32 6) nounwind readonly %.lobit.i = lshr i32 %25, 31 ; <i32> [#uses=1] %tmp.i = trunc i32 %.lobit.i to i8 ; <i8> [#uses=1] %toBool = icmp eq i8 %tmp.i, 0 ; <i1> [#uses=1] br i1 %toBool, label %bb3, label %bb4 which compiled to: call L_memcmp$stub shrl $31, %eax testb %al, %al jne LBB1_11 ## with this change, we compile it to: call L_memcmp$stub testl %eax, %eax js LBB1_11 This triggers all the time in common code, with patters like this: %169 = and i32 %ply, 1 ; <i32> [#uses=1] %170 = trunc i32 %169 to i8 ; <i8> [#uses=1] %toBool = icmp ne i8 %170, 0 ; <i1> [#uses=1] %7 = lshr i32 %6, 24 ; <i32> [#uses=1] %9 = trunc i32 %7 to i8 ; <i8> [#uses=1] %10 = icmp ne i8 %9, 0 ; <i1> [#uses=1] etc llvm-svn: 61985
* For PR1319:Reid Spencer2007-04-141-1/+1
| | | | | | Upgrade tests to work with new llvm.exp version of llvm_runtest. llvm-svn: 36013
* sext of compares.Chris Lattner2007-04-111-0/+14
| | | | llvm-svn: 35892
* new testcaseChris Lattner2007-04-111-0/+17
llvm-svn: 35889
OpenPOWER on IntegriCloud