aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/Scalar/GVN.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index edd11e8..1e9b177 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -856,10 +856,19 @@ bool GVN::processLoad(LoadInst* L,
// ... to a pointer that has been loaded from before...
MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
+ bool removedNonLocal = false;
Instruction* dep = MD.getDependency(L);
if (dep == MemoryDependenceAnalysis::NonLocal &&
- L->getParent() != &L->getParent()->getParent()->getEntryBlock())
- processNonLocalLoad(L, toErase);
+ L->getParent() != &L->getParent()->getParent()->getEntryBlock()) {
+ removedNonLocal = processNonLocalLoad(L, toErase);
+
+ if (!removedNonLocal)
+ last = L;
+
+ return removedNonLocal;
+ }
+
+
bool deletedLoad = false;
while (dep != MemoryDependenceAnalysis::None &&