[PATCH] D15124: Use @llvm.invariant.start/end intrinsics to extend the meaning of basic AA's pointsToConstantMemory(), for GVN-based load elimination purposes [Local objects only]

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 19:18:08 PST 2015


rnk added a subscriber: rnk.
rnk added a comment.

I read through this, and tried to check my understanding of it with Larisse. Here's how I see things working:

- GVN processes instructions in reverse post order. This means dominating blocks come first, i.e. defs before uses.
- GVN's processInstruction calls llvm::processInvariantIntrinsic() on invariant intrinsics
- This updates InvariantMap to hold values passed to invariant.start. A call to invariant.end will remove the pointer from the map, and a new invariant.start will overwrite it.
- BasicAA has been modified to return MRI_NoModRef for addresses that are present in InvariantMap, as well as other things. This is what enables GVN to do better.
- MemDep has been modified so that when it scans backwards across an invariant start, it won't still consider the memory to be constant and load something bad like undef.

Fundamentally, the approach of having a side table populated by GVN's instruction visitation order makes me nervous, but I'm not able to construct a solid counterexample as to why.


http://reviews.llvm.org/D15124





More information about the llvm-commits mailing list