diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 5f8bf84092c..f06a0e83c9b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2883,7 +2883,10 @@ Instruction *InstCombiner::foldICmpInstWithConstantNotInt(ICmpInst &I) {  /// In this case, we are looking for comparisons that look like  /// a check for a lossy truncation.  /// Folds: -///   x & (-1 >> y) SrcPred x    to    x DstPred (-1 >> y) +///   icmp SrcPred (x & Mask), x    to    icmp DstPred x, Mask +/// Where Mask is some pattern that produces all-ones in low bits: +///    (-1 >> y) +///   ~(-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. @@ -2891,7 +2894,9 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I,                                            InstCombiner::BuilderTy &Builder) {    ICmpInst::Predicate SrcPred;    Value *X, *M; -  auto m_Mask = m_CombineOr(m_LShr(m_AllOnes(), m_Value()), m_LowBitMask()); +  auto m_VariableMask = m_CombineOr(m_Not(m_Shl(m_AllOnes(), m_Value())), +                                    m_LShr(m_AllOnes(), m_Value())); +  auto m_Mask = m_CombineOr(m_VariableMask, m_LowBitMask());    if (!match(&I, m_c_ICmp(SrcPred,                            m_c_And(m_CombineAnd(m_Mask, m_Value(M)), m_Value(X)),                            m_Deferred(X)))) | 

