[PATCH] D114375: [SLP]Fix emission of int division with some undef vector subelements.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 13:21:40 PST 2021


ABataev added a comment.



In D114375#3147241 <https://reviews.llvm.org/D114375#3147241>, @vporpo wrote:

> I am not sure I understand why you are trying to get rid of the `undef` operands. Could you provide a code example that shows the issue?

The test `test/Transforms/SLPVectorizer/X86/arith-div-undef.ll` shows the problem. We have a gather of sdivs results, 2 of them are poisonous. And generally speaking, this gather shall end up with a vector `<poison, sdiv1, sdiv2, sdiv3, poison, sdiv4, sdiv5, sdiv6>`. But instead, the compiler generates just `<8 x i32> poison`. I think this result is more poisonous than the original one. Extract from lane 1, for example, should be different for these results.

Here is an example with just instcombiner https://godbolt.org/z/9rxesoM47



================
Comment at: llvm/test/Transforms/SLPVectorizer/X86/arith-div-undef.ll:6
 ; CHECK-LABEL: @sdiv_v8i32_undefs(
-; CHECK-NEXT:    ret <8 x i32> poison
 ;
----------------
lebedev.ri wrote:
> This is *NOT* a miscompile: https://alive2.llvm.org/ce/z/iMu-eF
Yes, also checked it via alive but not sure if alive is correct here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114375



More information about the llvm-commits mailing list