[llvm-dev] Poison/Undef at CodeGen level Was: [poison] is select-of-select to logic+select allowed?

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Fri May 26 15:15:24 PDT 2017


Hi,

On Fri, May 26, 2017 at 2:27 PM, Matthias Braun <mbraun at apple.com> wrote:
> Does that mean a vreg (or even a physreg) can conceptually hold a poison
> value? Given that failed to capture the semantics at the IR level I have bad
> feelings about getting this right at the MI level with all the additional
> machine specific semantics. Reasoning about optimisations definitely gets
> easier without poison and I'd really like to see some good example first to
> motivate the maintenance burden.
>
> A notion of unknown/unspecified value should be enough to enable hoisting,
> we shouldn't need poison for that.

The definition of poison we used in "Taming Undefined Behavior in
LLVM" has a natural expression of this -- we can say that in MI all
poison is "frozen on arrival".  However, this disallows sinking:

  %RAX = gen_frozen_poison
L:
  use(%RAX)
  jmp L

will not  be the same as:

L:
  %RAX = gen_frozen_poison
  use(%RAX)
  jmp L

Thanks,
-- Sanjoy


More information about the llvm-dev mailing list