diff options
| author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-14 12:20:16 +0000 |
|---|---|---|
| committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-14 12:20:16 +0000 |
| commit | e3dc587ae00bc4c79167a1be057ecd5efc0789aa (patch) | |
| tree | cb72016a94767f8446faa23db12f370ae907d923 /llvm/lib | |
| parent | cad4e3d741f12e1d00ef966432f9d351b7b5e93e (diff) | |
| download | bcm5719-llvm-e3dc587ae00bc4c79167a1be057ecd5efc0789aa.tar.gz bcm5719-llvm-e3dc587ae00bc4c79167a1be057ecd5efc0789aa.zip | |
[InstCombine] Fold x & (-1 >> y) u< x to x u> (-1 >> y)
https://bugs.llvm.org/show_bug.cgi?id=38123
https://rise4fun.com/Alive/ocb
This pattern is not commutative. But InstSimplify will
already have taken care of the 'commutative' variant.
llvm-svn: 337098
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index f89dca42a55..eec8fadedb2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2897,6 +2897,11 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I, assert(X == I.getOperand(1) && "instsimplify took care of commut. variant"); DstPred = ICmpInst::Predicate::ICMP_ULE; break; + case ICmpInst::Predicate::ICMP_ULT: + // x & (-1 >> y) u< x -> x u> (-1 >> y) + assert(X == I.getOperand(1) && "instsimplify took care of commut. variant"); + DstPred = ICmpInst::Predicate::ICMP_UGT; + break; // TODO: more folds are possible, https://bugs.llvm.org/show_bug.cgi?id=38123 default: return nullptr; |

