[llvm-dev] funnel shift, select, and poison

John Regehr via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 25 11:24:22 PST 2019


> Consider this:
> 
>    %v0 = call i32 @foo(poison) nounwind/readnone
>    store i32 %v0, i32* %valid_address
> 
> If we assume that poison propagates through calls, we could then 
> optimize this to
> 
>    %v0 = poison
>    store poison, i32* %valid_address

This is a sound transformation only if foo() returns poison when it is 
called with poison as an argument.

If this is what foo() looks like:

>    define i32 @foo(i32) { ret i32 0 }

then of course the transformation above is wrong.

John



More information about the llvm-dev mailing list