[llvm] [InstCombine] Do not simplify lshr/shl arg if it is part of fshl rotate pattern. (PR #66115)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 06:27:28 PDT 2023
================
@@ -669,6 +686,22 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
if (match(I->getOperand(1), m_APInt(SA))) {
uint64_t ShiftAmt = SA->getLimitedValue(BitWidth-1);
+ // Do not simplify if shl is part of fshl rotate pattern
+ if (I->hasOneUser()) {
+ auto *Op = I->user_back();
+ if (Op->getOpcode() == BinaryOperator::Or) {
+ const APInt *ShlAmt;
+ Value *ShlVal;
+ auto *Operand =
+ Op->getOperand(0) == I ? Op->getOperand(1) : Op->getOperand(0);
+ if (match(Operand, m_OneUse(m_Shl(m_Value(ShlVal), m_APInt(ShlAmt)))))
----------------
RKSimon wrote:
Use m_Specific(I->getOperand(0))?
https://github.com/llvm/llvm-project/pull/66115
More information about the llvm-commits
mailing list