[LLVMdev] The nsw story
David A. Greene
greened at obbligato.org
Mon Dec 5 15:50:13 PST 2011
Dan Gohman <gohman at apple.com> writes:
> And it would still mean that non-volatile store instructions suddenly
> can have side effects beyond just writing to their addressed memory.
> That would be surprising.
No more surprising than any hardware architecture that implements this
kind of poison tracking. You see the fault or undefined behavior at the
store. Yes, a compiler IR is not an ISA but we do get to define the IR
semantics. It's a contract where we get to specify all of the rules.
If you're more worried about things like the above rather than the high
static analysis cost these various suggestions are trying to address,
that's simply a particular tradeoff you'd rather make. There's no rule
that says any particular semantic is "surprising."
We make the tradeoffs we want and implement the semantics based on that.
> I think Dave also suggested making select instructions be
> observation points. That would mean that select instructions would
> have side effects. Again, that would be surprising.
How so? It certainly is an observable point. A select is just a branch
by another name. If the program behavior was undefined in the presence
of a branch, why shoudln't it be undefined in the presence of a select?
More information about the llvm-dev