From 6e43f22733d0d3d696bf1458d1ea2d1d46adc731 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Sat, 14 Jul 2018 20:08:52 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337112 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/InstCombine/InstCombineCompares.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index 94999ba3df2..784ff9eb56c 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/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); -- 2.50.1