[PATCH] D130103: [InstCombine] Add mul with negated power of 2 constant to canEvaluateShifted.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 20 09:22:15 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:692
+ auto *Neg = BinaryOperator::CreateNeg(I->getOperand(0));
+ IC.InsertNewInstWith(Neg, *I);
+ unsigned TypeWidth = I->getType()->getScalarSizeInBits();
----------------
spatel wrote:
> Is there a difference between using IC.Builder vs. manually inserting?
Inserting with IC.Builder would insert at the outer LShr. Since we might have gone through a binop that would be the wrong location. `foldShiftedShift` handles this by calling moveBefore after using IC.Builder. But that still takes the debug location from the outer LShr which seemed wrong. `InsertNewInstWith` is used by the `evaluateInDifferentType` code in InstCombineCasts.cpp
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130103/new/
https://reviews.llvm.org/D130103
More information about the llvm-commits
mailing list