[PATCH] D126895: [SLP] Phi inputs that come from an unreachable block should be undef.

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 11:07:57 PDT 2022


vporpo added a comment.

The issue is that the input to SLP contains phis with an undef input when the input is unreachable. Then SLP converts this to poison which I think is not legal. The end result is that enabling SLP breaks the benchmark.

A reduced example of the code that causes the issue looks like this:

  bb1:
     br label %bb3
  bb2:
    br label %bb3
  bb3:
   %phi0 = phi i8 [ %a0, %bb1 ], [ 1, %bb2]
   %phi1 = phi i8 [ %a1, %bb1 ], [ undef, %bb2 ]
   %zext0 = zext i8 %phi0 to i32
   %zext1 = zext i8 %phi1 to i32
   %or = or i32 %zext0, %zext1

%phi1 has an undef input, so %zext1 contains an i32 value with the lower 8-bits being undef. So the %or has the 24 high order bits zero.

SLP converts the undef to poison, which if I understand correctly causes %zext1 and %or to be poison, so no guarantees about the 24 high order bits being zero.

OK so if poison is the right value from unreachable blocks, then the issue must be in the pass that generates the undefs in the first place?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126895



More information about the llvm-commits mailing list