[PATCH] D93183: [BasicAA] Make sure context instruction is symmetric

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 14:23:27 PST 2020


nikic added a comment.

In D93183#2468883 <https://reviews.llvm.org/D93183#2468883>, @jdoerfert wrote:

> Maybe I don't understand this so I figure I ask: Couldn't we know about V2 at position Ctx1 than we know at Ctx2? If so, would it be correct to use Ctx1 information? I get the feeling that the answers are both "true" but I want to confirm first.

I'm not sure I got the question right, so possibly the answer is way off base...

When considering getModRef() between two instructions, the returned AA information is only (in the general case) valid under the assumption that both instructions have been executed. (This is most obvious for the case of noalias attributes/metadata.) As such, the information can only be valid at program points that are reachable from both instructions. The alias() interface then only considers the stored/loaded operands, rather than the load/store instruction itself, which is a conservative approximation. Once again, the result of the alias API is only valid at program points that are reachable from both operand defs. We can then use either of the operands as context, because the region of validity for the AA result has to be reachable from both. It's once again a conservative approximation. So if we have a VarIndex on GEP1 we could also use GEP2 as context, and the other way around. This patch just picks the GEP it occurs on to ensure the choice is predictable/symmetric.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93183/new/

https://reviews.llvm.org/D93183



More information about the llvm-commits mailing list