[PATCH] D138814: [InstCombine] Combine a/lshr of add -> uadd.with.overflow
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 05:32:01 PST 2022
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:853
+ const bool IsAShr = (I.getOpcode() == Instruction::AShr);
+ Instruction *Op0 = dyn_cast<Instruction>(I.getOperand(0));
+ Value *Op1 = I.getOperand(1);
----------------
I think it would be nicer to hoist the match and rename the variable.
```
Value *Add = I.getOperand(0);
Value *X = nullptr, *Y = nullptr;
if (!match(Add, m_Add(m_Value(X), m_Value(Y))))
return nullptr;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138814/new/
https://reviews.llvm.org/D138814
More information about the llvm-commits
mailing list