[PATCH] D109537: [InstCombine] move extend after insertelement if both operands are extended
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 9 12:53:30 PDT 2021
spatel added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/insert-ext.ll:62-64
; CHECK-NEXT: [[V:%.*]] = sext <2 x i16> [[X:%.*]] to <2 x i32>
; CHECK-NEXT: [[S:%.*]] = sext i8 [[Y:%.*]] to i32
; CHECK-NEXT: [[I:%.*]] = insertelement <2 x i32> [[V]], i32 [[S]], i32 [[INDEX:%.*]]
----------------
lebedev.ri wrote:
> I guess it will depend on our profitability/correctness reasoning for this transform,
> but under standard instcombine profitability model we should be fine producing
> ```
> %s = sext i8 %y to i16
> %i = insertelement <2 x i16> %x, i16 %s, i32 %index
> %r = sext <2 x i16> %i to <2 x i32>
> ```
>
Yes - I thought about including this one, but it seemed improbable and makes the use check a bit more restrictive. Ie, if we're creating 3 new insts, then we need one-use on both of the operands.
And I wasn't sure, but it does seem to hold for fpext too:
https://alive2.llvm.org/ce/z/QNQKWt
I can make that a TODO if that's ok.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109537/new/
https://reviews.llvm.org/D109537
More information about the llvm-commits
mailing list