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

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 11:49:24 PDT 2022


nlopes added a comment.

In D126895#3554064 <https://reviews.llvm.org/D126895#3554064>, @vporpo wrote:

> I think that the issue boils down to whether: `%zext = zext i8 poison to i32` is an i32 poison.

It is: https://llvm.org/docs/LangRef.html#poison-values

> But for a phi with a poison input it will generate this:
>
>   bb1:
>     %phi.cast = zext <2 x i8> %arg to <2 x i32>
>     br label %bb3
>   bb2:                                              ; No predecessors!
>     br label %bb3
>   bb3:                                              ; preds = %bb2, %bb1   
>     %phi = phi <2 x i32> [ %phi.cast, %bb1 ], [ <i32 1, i32 poison>, %bb2 ]
>
> The input from %bb2 is now an i32 poison, which does not seem to hold the same properties as a zero-extended i8 poison.

That's a correct transformation. zext poison == poison.

I'll say this one last time: the patch you proposed although it's correct, it's not desirable: it's a regression in terms of performance. If you are seeing a miscompilation, the bug is not in the line you've changed.


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