[llvm-dev] RFC: Killing undef and spreading poison

Nuno Lopes via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 25 10:10:43 PDT 2016


>> On Oct 18, 2016, at 1:12 PM, Sanjoy Das via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>> 
>> Hi Krzysztof,
>> 
>> freeze(poison) is different from undef today, in the sense that it is an instruction that produces some random, but fixed bit pattern.
>> 
>> E.g. today in
>> 
>>  %x = undef
>>  %y = xor %x, %x
>> 
>> we can fold %y to undef since each use of %x can independently see some arbitrary (up to the compiler / environment) bit pattern.
>> 
>> But in the new proposal, in:
>> 
>>  %x = freeze(poison)
>>  %y = xor %x, %x
>
> 
> What is 
> 
>  %x = freeze(poison)
>  %y = freeze(poison)
>  %z = xor %x, %y
> 
> going to result into?

%x and %y will be arbitrary, and possibly distinct values.
Therefore you can replace %z with a new "freeze poison" instruction (assuming %x and %y have no other uses).
If %x and %y have other uses, no similar rewrite can be done without taking all other uses into account.

Nuno



More information about the llvm-dev mailing list