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

Sanjay Patel via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 27 06:45:32 PST 2019


I don't object to deferring the optimization, but let me check my poison
understanding...
  select i1 %cond, i1 true, i1 %x --> or i1 %cond, %x

1. 'select' is a poison-blocking operation, but 'or' is
non-poison-blocking, so we are propagating a potentially poisonous %x with
this transform.
2. We will fix the problem in IR by removing this transform in IR
3. The backend (SDAG) has that same transform.
4. SDAG has poison because we propagate the wrapping/exact flags to DAG
nodes.
5. Are we just sweeping the bug under the rug? Nobody cares because SDAG is
undocumented, so anything goes down there?


On Tue, Feb 26, 2019 at 2:06 PM John Regehr via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> > Transforms/InstCombine/select.ll
> > ================================
> > define i1 @trueval_is_true(i1 %C, i1 %X) {
> >   %R = select i1 %C, i1 1, i1 %X
> >   ret i1 %R
> > }
> > =>
> > define i1 @trueval_is_true(i1 %C, i1 %X) {
> >   %R = or i1 %C, %X
> >   ret i1 %R
> > }
> > ERROR: Target is more poisonous than source (when %C = #x1 & %X = poison)
> >
> > (there are many variations of these select->arithmetic transformations)
>
> This particular little family of transformations can be reliably done by
> all of the backends I looked at, so disabling them at the IR level
> should be OK. See a bit more discussion here:
>
> > https://bugs.llvm.org/show_bug.cgi?id=40768
>
> John
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190227/3331249c/attachment.html>


More information about the llvm-dev mailing list