[PATCH] D130103: [InstCombine] Add mul with negated power of 2 constant to canEvaluateShifted.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 20 06:11:40 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:691
+ case Instruction::Mul: {
+ auto *Neg = BinaryOperator::CreateNeg(I->getOperand(0));
+ IC.InsertNewInstWith(Neg, *I);
----------------
Can we assert !isLeftShift and/or this is a mul with negated-pow2-constant?
================
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();
----------------
Is there a difference between using IC.Builder vs. manually inserting?
================
Comment at: llvm/test/Transforms/InstCombine/shift.ll:1844
define i64 @lshr_mul_negpow2_2(i64 %x) {
; CHECK-LABEL: @lshr_mul_negpow2_2(
----------------
Do we have a negative test with an extra use of the mul?
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