We don't want to find dependencies within the same block in this case. It leads to incorrect results because
we're detecting something at or after the call we're querying on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52433 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 563f6e6..7ea3ed8 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -492,7 +492,7 @@
return nextValueNumber++;
} else if (I->second != MemoryDependenceAnalysis::NonLocal) {
- if (DT->dominates(I->first, C->getParent())) {
+ if (DT->properlyDominates(I->first, C->getParent())) {
if (CallInst* CD = dyn_cast<CallInst>(I->second))
cdep = CD;
else {