Nuno Lopes via llvm-dev
2016-Oct-18 21:29 UTC
[llvm-dev] RFC: Killing undef and spreading poison
> 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)?Yes, that's ok.> %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)?"icmp %x, %y" would be poison (so you can chose true or false if you wish). There's no change here with respect to current poison semantics. freeze(%x) is not necessarily the same as freeze(%y). Even %a and %b might not be the same in "%a = freeze(%x), %b = freeze(%x)" (each freeze returns an arbitrary, but fixed, value). Nuno
Krzysztof Parzyszek via llvm-dev
2016-Oct-20 15:18 UTC
[llvm-dev] RFC: Killing undef and spreading poison
On 10/18/2016 4:29 PM, Nuno Lopes wrote:> Even %a and %b might not be the same in "%a = freeze(%x), %b > freeze(%x)" (each freeze returns an arbitrary, but fixed, value).Assume that %x is known to be a poison value and have: %a = freeze(%x) %b = freeze(%x) Is %a == %a true? Is %a == %b true? -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Sanjoy Das via llvm-dev
2016-Oct-20 20:36 UTC
[llvm-dev] RFC: Killing undef and spreading poison
Hi Krzysztof, Krzysztof Parzyszek wrote:> On 10/18/2016 4:29 PM, Nuno Lopes wrote: >> Even %a and %b might not be the same in "%a = freeze(%x), %b >> freeze(%x)" (each freeze returns an arbitrary, but fixed, value). > > Assume that %x is known to be a poison value and have: > %a = freeze(%x) > %b = freeze(%x) > > Is %a == %a true?Yes, %a is always == %a. It is a normal SSA value with some unspecific content.> Is %a == %b true?Not necessarily; but the compiler can make it true by (consistently) choosing equal values for %a and %b. By consistently I mean it can't fold one instance of %a == %b to true and fold another instance of %a == %b to false. -- Sanjoy