[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
Wed Sep 15 06:27:37 PDT 2021


spatel added a comment.

In D109537#2997664 <https://reviews.llvm.org/D109537#2997664>, @anton-afanasyev wrote:

>> If this looks ok, then instcombine can handle the relatively simple tests in the other patch.
>> So we might want to make those a bit longer to show the power of the more general approach in -aggressive-instcombine.
>
> No one of tests touched by D109236 <https://reviews.llvm.org/D109236> isn't processed by this patch, since they are not matched by `inselt (ext X), (ext Y), Index` pattern.

What I meant is that the tests in that patch are reduced by instcombine after this patch, so there's nothing left for AIC to do if regular instcombine runs first:

  $ opt -instcombine 109236.ll -S
  
  define <2 x i16> @extract_insert(<2 x i8> %a, <2 x i8> %b) {
    %1 = shufflevector <2 x i8> %b, <2 x i8> %a, <2 x i32> <i32 0, i32 2>
    %trunc = zext <2 x i8> %1 to <2 x i16>
    ret <2 x i16> %trunc
  }
  
  define <2 x i16> @insert_poison(i8 %a) {
    %1 = zext i8 %a to i16
    %trunc = insertelement <2 x i16> undef, i16 %1, i32 0
    ret <2 x i16> %trunc
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109537/new/

https://reviews.llvm.org/D109537



More information about the llvm-commits mailing list