diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 077fa67e0bd..eb91b5a043d 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1287,15 +1287,16 @@ bool GVN::iterateOnFunction(Function &F) { DominatorTree &DT = getAnalysis(); SmallVector toErase; - + DenseMap lastSeenLoad; + // Top-down walk of the dominator tree for (df_iterator DI = df_begin(DT.getRootNode()), E = df_end(DT.getRootNode()); DI != E; ++DI) { // Get the set to update for this block ValueNumberedSet& currAvail = availableOut[DI->getBlock()]; - DenseMap lastSeenLoad; - + lastSeenLoad.clear(); + BasicBlock* BB = DI->getBlock(); // A block inherits AVAIL_OUT from its dominator