diff options
| author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-07-10 16:07:35 +0000 |
|---|---|---|
| committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-07-10 16:07:35 +0000 |
| commit | c5f92bd67beabfc2c8d20af9a799a8c9c8f7ed95 (patch) | |
| tree | 41cddfc863815e553dfedf3c22bd89362cd5b2de /llvm/lib/Transforms | |
| parent | bf223dff7ef076733c9b28c992028ee2dc8c9114 (diff) | |
| download | bcm5719-llvm-c5f92bd67beabfc2c8d20af9a799a8c9c8f7ed95.tar.gz bcm5719-llvm-c5f92bd67beabfc2c8d20af9a799a8c9c8f7ed95.zip | |
[PatternMatch] Generalize m_SpecificInt_ULT() to take ICmpInst::Predicate
As discussed in the original review, this may be useful,
so let's just do it.
llvm-svn: 365652
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 4c818193ced..3a4283ae540 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -3316,7 +3316,8 @@ foldShiftIntoShiftInAnotherHandOfAndInICmp(ICmpInst &I, const SimplifyQuery SQ, // Is the new shift amount smaller than the bit width? // FIXME: could also rely on ConstantRange. unsigned BitWidth = X->getType()->getScalarSizeInBits(); - if (!match(NewShAmt, m_SpecificInt_ULT(APInt(BitWidth, BitWidth)))) + if (!match(NewShAmt, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, + APInt(BitWidth, BitWidth)))) return nullptr; // All good, we can do this fold. The shift is the same that was for X. Value *T0 = XShiftOpcode == Instruction::BinaryOps::LShr diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index 0bbecde2184..c821292400c 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -48,7 +48,8 @@ reassociateShiftAmtsOfTwoSameDirectionShifts(BinaryOperator *Sh0, // Is the new shift amount smaller than the bit width? // FIXME: could also rely on ConstantRange. unsigned BitWidth = X->getType()->getScalarSizeInBits(); - if (!match(NewShAmt, m_SpecificInt_ULT(APInt(BitWidth, BitWidth)))) + if (!match(NewShAmt, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, + APInt(BitWidth, BitWidth)))) return nullptr; // All good, we can do this fold. BinaryOperator *NewShift = BinaryOperator::Create(ShiftOpcode, X, NewShAmt); |

