summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-07-14 16:44:54 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-07-14 16:44:54 +0000
commit0f5ec8921b31da4befe64e01e46afbf0ce7d6e88 (patch)
treed2acc1f49a13fdc7c12cdd714447b19c12a7263c /llvm/lib
parent79ee3211ba5285333c065ca6969a84e0598156f1 (diff)
downloadbcm5719-llvm-0f5ec8921b31da4befe64e01e46afbf0ce7d6e88.tar.gz
bcm5719-llvm-0f5ec8921b31da4befe64e01e46afbf0ce7d6e88.zip
[InstCombine] Fold x u<= x & C to x u<= C
https://bugs.llvm.org/show_bug.cgi?id=38123 https://rise4fun.com/Alive/Fqp This pattern is not commutative. But InstSimplify will already have taken care of the 'commutative' variant. llvm-svn: 337102
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 1024cbafaaa..2a8d83fde2c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2907,6 +2907,11 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I,
assert(X == I.getOperand(1) && "instsimplify took care of commut. variant");
DstPred = ICmpInst::Predicate::ICMP_UGT;
break;
+ case ICmpInst::Predicate::ICMP_ULE:
+ // x u<= x & (-1 >> y) -> x u<= (-1 >> y)
+ assert(X == I.getOperand(0) && "instsimplify took care of commut. variant");
+ DstPred = ICmpInst::Predicate::ICMP_ULE;
+ break;
// TODO: more folds are possible, https://bugs.llvm.org/show_bug.cgi?id=38123
default:
return nullptr;
OpenPOWER on IntegriCloud