[llvm-dev] [poison] is select-of-select to logic+select allowed?

John Regehr via llvm-dev llvm-dev at lists.llvm.org
Mon May 22 13:56:36 PDT 2017


I should remind that what we really want to do (at the same time as 
items 1 and 2 below) is to merge poison and undef into a single concept, 
along with adding a new freeze instruction that gives the benefits of 
both without (we hope) the current level of confusion.

We have patches to this effect and we need help moving towards a 
consensus that this approach (or some different approach) is the way 
forward.

https://reviews.llvm.org/D29011
https://reviews.llvm.org/D29121
https://reviews.llvm.org/D29013

John



On 5/22/17 2:45 PM, John Regehr via llvm-dev wrote:
> Nuno and I have been looking through the results of experiments like the
> one reported here:
>
>   https://blog.regehr.org/archives/1510
>
> Indeed there are some select-related transformations in LLVM that are
> illegal in terms of Alive's semantics. As far as we know, they cannot be
> made legal (by adjusting the semantics of instructions) without breaking
> a bunch of other optimizations.
>
> The optimizations currently in LLVM are not only inconsistent but they
> can lead to end-to-end miscompilations. Sorting this out is going to
> require (1) figuring out what select means WRT poison/undef and (2)
> backing out some optimizations. This is going to be slightly painful but
> it is the only way forward.
>
> John
>
>
>
> On 5/22/17 2:32 PM, Sanjay Patel wrote:
>> Some InstCombine transforms for select-of-select were added here:
>> https://reviews.llvm.org/rL228409
>>
>> But Alive says this is more poisonous:
>>
>> Name: selsel
>> %s1 = select i1 %cond1, i8 C1, i8 C2
>> %s2 = select i1 %cond2, i8 %s1, i8 C2
>>   =>
>> %andcond = and i1 %cond1, %cond2
>> %s2 = select i1 %andcond, i8 C1, i8 C2
>>
>> http://rise4fun.com/Alive/JT6
>>
>> Are those transforms legal?
>>
> _______________________________________________
> 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