[PATCH] Clarify wording in the LangRef around !invariant.load
Nick Lewycky
nicholas at mxc.ca
Mon Nov 24 02:06:19 PST 2014
Andrew Trick wrote:
Comparing pointers of different objects should be considered illegal in
LLVM, although I'm not sure where that's spelled out.
"If the operands are pointer typed, the pointer values are compared as
if they were integers." - http://llvm.org/docs/LangRef.html#id251
I disagree, and think llvm's current model is right. There used to be
(still are?) some interesting rules on the inbounds gep instruction, but
nothing that applies to pointers in general.
We do end up with weird cases such as %ptr1 noalias %ptr2 while %ptr1 ==
%ptr2, but that only comes up because we recognize C functions and
graciously handle C's aliasing rules for things like freed pointers and
such. It's not actually part of llvm's execution semantics, nor does it
need to be. It might hurt support for other languages if we did, and it
would make %p eq %q different from ptrtoint %p eq ptrtoint %q, which in
turn means you can't do transforms which that a given i64 in memory is
always used as a pointer and replace the type loads and stores referring
to it.
Nick
More information about the llvm-commits
mailing list