Thanks for taking the time to respond.
Regarding GVN and newGVN, I recently finished a search through the
llvm-dev archives for “nsw” in the subject line, and GVN was discussed in
some of those threads .
In particular it was claimed that there was a right choice for GVN to make given
two ADD instructions, one with the “nsw” attribute and one without, the one
without ‘nsw’ must be the representative.
This was described as a correctness issue, not an optimality issue. IE if you
are going to CSE those two ADDs, it is safe to loose information (drop the ‘nsw’)
but it is unsafe to put ‘nsw’ on to an operation that didn’t already have it
because that is like inserting an “llvm.assume" where there was none.
So I am extrapolating from ’nsw’ instruction attribute, to ‘poison’ value attribute,
And wondering if (expecting that) you think the same logic applies.
I make no claim as to optimality, which seems to be what you are getting at.
Are you saying the post I am citing is incorrect ?
Or that I misunderstood it ?
Or could it be that you misread my email ?
Yes I am hoping Nuno can come up with a better example. There is a claim
that “branch on poison is undefined behavior” is the right definition, which is
not justified in the Paper , which John is waffling on, which no one seems to
be able to justify, and which gives the appearance at least of flying in the face
of common sense.
This is the IR definition we’re talking about here, the literal heart and soul of
the compiler, everyone should be at least a little bit concerned.
[1. I’m having difficulty locating the post, here’s one that is similar
Tue Jul 22, 2014 “On semantics of add instruction - nsw, nuw”
It also occurs to me that the more detailed post I am remembering but
can’t find might have been about SCEV rather than GVN ]
[2. “Taming undefined behavior in LLVM” ]