[llvm] r337112 - [NFC][InstCombine] foldICmpWithLowBitMaskedVal(): update comments.
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 14 13:08:52 PDT 2018
Author: lebedevri
Date: Sat Jul 14 13:08:52 2018
New Revision: 337112
URL: http://llvm.org/viewvc/llvm-project?rev=337112&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=337112&r1=337111&r2=337112&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Sat Jul 14 13:08:52 2018
@@ -2872,6 +2872,8 @@ Instruction *InstCombiner::foldICmpInstW
/// 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 *foldICmpWithLowBitMaskedVa
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);
More information about the llvm-commits
mailing list