[LLVMdev] RFC: Proposal for Poison Semantics

Sanjoy Das sanjoy at playingwithpointers.com
Sun Feb 1 13:06:53 PST 2015


> I don't know how things work at the moment, but it seems to me that you can
> do lots of sensible things, and avoid lots of silly things, if you keep
> track of four possible values for each bit:
>
> - undef (the default)
> - poison
> - known to be 0
> - known to be 1

I'm not clear what you mean by "known to be X", but assuming you mean
"known" in the same sense of computeKnownBits, then I don't think such
a distinction will lead to intuitive semantics.  If the semantics of a
program depended on what the compiler can prove about the program,
then the meaning of a program will change based on how smart the
compiler is (i.e. does the /compiler/ know that `add i32 10, 9` is
`i32 19`?).  As a concrete example, outlining a function to a separate
module will no longer be a meaning preserving transform because then a
bit could go from "known to be 0" to "nothing is known".

Sorry for the tangent, in case you meant something completely
different by "known". :)

-- Sanjoy



More information about the llvm-dev mailing list