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

Nuno Lopes via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 18 14:33:27 PDT 2016


We need a literal like undef to e.g. initialize padding, use in SROA for phi 
node entries from branches where a variable is not initialized, constant 
folding, etc.  We are just proposing to get rid of undef altogether and call 
it poison instead.  It makes the compiler a bit more aggressive re undefined 
behavior, though.

If freeze(%x) is duplicated it can return a different value. Not having a 
poison literal doesn't change that.

Nuno

-----Original Message-----
From: Krzysztof Parzyszek via llvm-dev
Sent: Tuesday, October 18, 2016 10:09 PM
Subject: Re: [llvm-dev] RFC: Killing undef and spreading poison

I guess, it may help if we don't have a literal for poison (as we do for
undef).

Then freeze(%x) would always be equal to freeze(%x) and there would be
no question about freeze(poison).

-Krzysztof


On 10/18/2016 3:22 PM, Krzysztof Parzyszek via llvm-dev wrote:
> On 10/18/2016 3:12 PM, Sanjoy Das wrote:
>> But in the new proposal, in:
>>
>>   %x = freeze(poison)
>>   %y = xor %x, %x
>>
>> that is no longer allowed (%y _has_ to be 0) -- all uses of %x will see
>> some garbage, but fixed bit pattern.
>
> What about this:
>   %x = phi poison, poison  (I'm simplifying the syntax here)
> Can this be simplified to "%x = poison", i.e. can we rauw(%x, poison)?
>
> Or
>   %x = load %uninitialized_var
>   %y = load %uninitialized_var
>   // are %x and %y equal (i.e. is "cmp eq %x, %y" == true)?
>   // is freeze(%x) equal to freeze(%y)?
>
> I'm wary about such rules. I have a feeling that this is going to create
> its own set of problems.
>
> -Krzysztof
>
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev 



More information about the llvm-dev mailing list