[PATCH] D10368: Analyze recursive PHI nodes in BasicAA
Sanjoy Das
sanjoy at playingwithpointers.com
Sat Jul 11 13:27:54 PDT 2015
sanjoy added a comment.
In http://reviews.llvm.org/D10368#201839, @tobiasvk_caf wrote:
> Sanjoy, thanks for clarifying the semantics of undef. I can see how my code would break if aliasGEP ever started to exploit those semantics. I have been thinking of what else could be used to represent "any arbitrary value that the compiler cannot reason about"... I suppose we could create another temporary, like a load from undef? Pushing logic to special-case those temporary GEP values directly into aliasGEP may be another option but it seems a little intrusive to me.
Sorry I did not respond to this earlier, for some reason I did not see the phabricator email.
I don't think load from `undef` is okay -- load from `undef` is undefined behavior, which is even worse than `undef`.
If I were you, I'd restructure `BasicAliasAnalysis::aliasCheck` to not take an `llvm::Value` but an `llvm::Value` + a constant offset, and the offset data type would have two extra values other than constant integers -- `Unknown` and `Any` (for your use case, you only need `Unknown`). Then you can ask do an alias check against `gep(V, unknown)` without creating a temporary instruction.
http://reviews.llvm.org/D10368
More information about the llvm-commits
mailing list