From 53336d80557b81c54793085280c026dd218f0c75 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 10 Apr 2008 22:13:32 +0000 Subject: [PATCH] Fix for PR2190. Memdep's non-local caching was checking dirtied blocks in the wrong order. llvm-svn: 49499 --- llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index e881f799a678..00e857dea16a 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -181,7 +181,9 @@ void MemoryDependenceAnalysis::nonLocalHelper(Instruction* query, // Current stack of the DFS SmallVector stack; - stack.push_back(block); + for (pred_iterator PI = pred_begin(block), PE = pred_end(block); + PI != PE; ++PI) + stack.push_back(*PI); // Do a basic DFS while (!stack.empty()) { @@ -208,7 +210,7 @@ void MemoryDependenceAnalysis::nonLocalHelper(Instruction* query, // If we re-encounter the starting block, we still need to search it // because there might be a dependency in the starting block AFTER // the position of the query. This is necessary to get loops right. - } else if (BB == block && stack.size() > 1) { + } else if (BB == block) { visited.insert(BB); Instruction* localDep = getDependency(query, 0, BB);