Fix a miscompilation in spiff on PPC.
authorOwen Anderson <resistor@mac.com>
Thu, 29 Nov 2007 18:02:22 +0000 (18:02 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 29 Nov 2007 18:02:22 +0000 (18:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44437 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp

index e3ce9eb62a4725cf042436ffa5307faedd3fe562..7799befb3c25327e0d1c33fcb16bd5a90a9bd03a 100644 (file)
@@ -1054,7 +1054,8 @@ bool GVN::processInstruction(Instruction* I,
       if (CI->getCalledFunction() &&
           !AA.doesNotAccessMemory(CI->getCalledFunction())) {
         MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
-        if (MD.getDependency(CI) != MD.getDependency(cast<CallInst>(repl))) {
+        if (cast<Instruction>(repl)->getParent() != CI->getParent() ||
+            MD.getDependency(CI) != MD.getDependency(cast<CallInst>(repl))) {
           // There must be an intervening may-alias store, so nothing from
           // this point on will be able to be replaced with the preceding call
           currAvail.erase(repl);