[PATCH] D106053: [CodeGen] Remove pending AssertZext AssertSext in promoting FP_TO_INT

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 17:20:11 PDT 2021


xiangzhangllvm added a comment.

This cause a runfail of a big project, Let me show key context of the test first:

%wide.insert226vector_func.i = shufflevector <32 x i8> %wide.insert224vector_func.i, <32 x i8> %extended.225vector_func.i, <32 x i32> <i32 0, i32 32, i32 undef, i32 3, i32 4, i32 33, i32 undef, i32 7, i32 8, i32 34, i32 undef, i32 11, i32 12, i32 35, i32 undef, i32 15, i32 16, i32 36, i32 undef, i32 19, i32 20, i32 37, i32 undef, i32 23, i32 24, i32 38, i32 undef, i32 27, i32 28, i32 39, i32 undef, i32 31>

it try to convert to (late me trunc the first 4 element of shuffle mask)

%wide.insert226vector_func.i0 = shufflevector <32 x i8> %wide.insert224vector_func.i, <32 x i8> --, <32 x i32> <i32 0, i32 zo, i32 undef, i32 3...>                // zo means set here element = 0,   -- means "can optimize out this operand"
 %wide.insert226vector_func.i1 = shufflevector <32 x i8> %--, <32 x i8> %extended.225vector_func.i, <32 x i32> <i32 zo, i32 33, i32 zo, i32 zo...>  
 %wide.insert226vector_func.i  = %wide.insert226vector_func.i0 |  %wide.insert226vector_func.i1

But the first IR %wide.insert226vector_func.i0 can be directly replaced by its operand %wide.insert224vector_func.i when the index 1, 1+4, 1+2*4 ... is zero.  
@RKSimon 's patch (optimization: https://reviews.llvm.org/rG2a419a0b9957ebac9e11e4b43bc9fbe42a9207df) will try check if related elements is zero, and @craig.topper 's patch happen generated AssertZext to show this element is zero.
But in fact , this element may be undef.

Let me upload the small reproduce test soon. (if you remove @RKSimon 's patch, that will be more obvious)


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

https://reviews.llvm.org/D106053



More information about the llvm-commits mailing list