summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-07-14 20:08:52 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-07-14 20:08:52 +0000
commitc7bc4c02eb3ebb1075ac608a8351e8c9ccb92ee6 (patch)
tree62f479c80de8e630e9e3fbaace92ad7c12c6587a
parentb972fc3e8a2e9569685a794cad7546d895935ccd (diff)
downloadbcm5719-llvm-c7bc4c02eb3ebb1075ac608a8351e8c9ccb92ee6.tar.gz
bcm5719-llvm-c7bc4c02eb3ebb1075ac608a8351e8c9ccb92ee6.zip
[NFC][InstCombine] foldICmpWithLowBitMaskedVal(): update comments.
All predicates are handled. There does not seem to be any other possible folds here. There are some more folds possible with inverted mask though. llvm-svn: 337112
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 94999ba3df2..784ff9eb56c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2872,6 +2872,8 @@ Instruction *InstCombiner::foldICmpInstWithConstantNotInt(ICmpInst &I) {
/// Folds:
/// x & (-1 >> y) SrcPred x to x DstPred (-1 >> y)
/// The Mask can be a constant, too.
+/// For some predicates, the operands are commutative.
+/// For others, x can only be on a specific side.
static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I,
InstCombiner::BuilderTy &Builder) {
ICmpInst::Predicate SrcPred;
@@ -2936,9 +2938,8 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I,
return nullptr; // Ignore the other case.
DstPred = ICmpInst::Predicate::ICMP_SLE;
break;
- // TODO: more folds are possible, https://bugs.llvm.org/show_bug.cgi?id=38123
default:
- return nullptr;
+ llvm_unreachable("All possible folds are handled.");
}
return Builder.CreateICmp(DstPred, X, M);
OpenPOWER on IntegriCloud