GVN-hoist: invalidate MD cache (PR29144)
authorSebastian Pop <sebpop@gmail.com>
Sat, 27 Aug 2016 02:48:41 +0000 (02:48 +0000)
committerSebastian Pop <sebpop@gmail.com>
Sat, 27 Aug 2016 02:48:41 +0000 (02:48 +0000)
Without invalidating the entries in the MD cache we would try to access instructions
that were removed in previous iterations of hoisting.

Differential Revision: https://reviews.llvm.org/D23927

llvm-svn: 279907

llvm/lib/Transforms/Scalar/GVNHoist.cpp

index e287ba7..4a6e934 100644 (file)
@@ -846,6 +846,8 @@ private:
           Repl->intersectOptionalDataWith(I);
           combineKnownMetadata(Repl, I);
           I->replaceAllUsesWith(Repl);
+          // Also invalidate the Alias Analysis cache.
+          MD->removeInstruction(I);
           I->eraseFromParent();
         }