[PATCH] Sink store based on alias analysis
Elena Demikhovsky
elena.demikhovsky at intel.com
Thu Dec 4 04:04:35 PST 2014
================
Comment at: lib/Transforms/Scalar/MergedLoadStoreMotion.cpp:421
@@ -426,11 +420,3 @@
- // Only move loads if they are used in the block.
- if (isStoreSinkBarrier(Inst))
- break;
- if (isa<StoreInst>(Inst)) {
- AliasAnalysis::Location LocSI = AA->getLocation(SI);
- AliasAnalysis::Location LocInst = AA->getLocation((StoreInst *)Inst);
- if (AA->isMustAlias(LocSI, LocInst)) {
- I = (StoreInst *)Inst;
- break;
- }
+ if (!isa<StoreInst>(Inst))
+ continue;
----------------
reames wrote:
> Rather than stopping on the first readwrite call, this function will now rescan the end of the basic block for each store in the basic block. That seems mildly expensive: O(N^2) in the number of instructions in the BB. Have you considered the implications for compile time?
Hi Philip,
We already discussed about this when I implemented load hoisting. When you go through the first basic block, you don't know what to check. Because not every store/load is a barrier.
We are looking at pointer location while going through the second block. If the both strore instructions are indentical we start to look for a barrier - we do less checks in comparison to the previous implementation.
I do not expect the implications for compile time in this case.
- Elena
http://reviews.llvm.org/D6420
More information about the llvm-commits
mailing list