]> granicus.if.org Git - llvm/commitdiff
[NFC][InstCombine] foldICmpWithLowBitMaskedVal(): update comments.
authorRoman Lebedev <lebedev.ri@gmail.com>
Sat, 14 Jul 2018 20:08:52 +0000 (20:08 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sat, 14 Jul 2018 20:08:52 +0000 (20:08 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337112 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineCompares.cpp

index 94999ba3df201054f7dcfadb17a66b424418dfd5..784ff9eb56c445655d660eaf2c46806b999a7ade 100644 (file)
@@ -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);