[llvm-dev] killing undef and spreading poison

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 19 09:43:38 PDT 2017


Hi Peter,

On Mon, Jun 19, 2017 at 7:14 AM, Peter Lawrence
<peterl95124 at sbcglobal.net> wrote:
>             My belief is that this is a register allocation problem
> that should not be addressed in the IR.

This is getting weird since you've started so many threads, but it
isn't *just* a register allocator problem (edit: just noticed that
Martin something similar) -- in your "live in undef value" scheme
there also are mid-level optimizations we will not be able to do.

> However you have changed the subject, and we still need an example

I'm not convinced that I changed the subject.  You said

>           we still need some examples showing that the definition
> “Branching on poison is immediate-UB” is the best choice,
> so far we only have arguments against it (the one for loop-switching).

There are two ways we can avoid branching on “Branching on poison is
immediate-UB” and still have GVN propagate equalities:

 - Propagate equalities only if the thing we're propagating isn't
poison.  As I've stated in this thread, that's almost impossible to
prove in interesting cases.
 - Ditch poison and have an `undef` like instruction (which is
equivalent to a live-in undef register), which brings us the regalloc
and mid-level opt problem.

So both of the thing I said seem on-topic to me.

-- Sanjoy


More information about the llvm-dev mailing list