diff options
author | John McCall <rjmccall@apple.com> | 2010-07-29 09:04:45 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-29 09:04:45 +0000 |
commit | e2921432b6e0ba916ebfca312ae2cac7641279ec (patch) | |
tree | 277acc92c17e1c897d2eb49ed9207e945e6fdd07 /tools | |
parent | 02e116cb060dc7694bf0ea911bace0340114c6ba (diff) |
Diagnose non-structural differences in the case where blocks were
structurally identical.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109743 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-diff/DifferenceEngine.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/llvm-diff/DifferenceEngine.cpp b/tools/llvm-diff/DifferenceEngine.cpp index d9fbc57d2d..764b56a296 100644 --- a/tools/llvm-diff/DifferenceEngine.cpp +++ b/tools/llvm-diff/DifferenceEngine.cpp @@ -194,7 +194,7 @@ class FunctionDifferenceEngine { // If the instructions differ, start the more sophisticated diff // algorithm at the start of the block. - if (diff(LeftI, RightI, false, true)) { + if (diff(LeftI, RightI, false, false)) { TentativeValues.clear(); return runBlockDiff(L->begin(), R->begin()); } @@ -207,11 +207,22 @@ class FunctionDifferenceEngine { } while (LI != LE); // This is sufficient: we can't get equality of // terminators if there are residual instructions. - // Make all the tentative pairs solid. - for (llvm::DenseSet<std::pair<Value*,Value*> >::iterator - I = TentativeValues.begin(), E = TentativeValues.end(); I != E; ++I) - Values[I->first] = I->second; TentativeValues.clear(); + + // Do another pass over the block, this time in complaints mode. + LI = L->begin(); RI = R->begin(); + do { + assert(LI != LE && RI != RE); + bool Result = diff(&*LI, &*RI, true, true); + assert(!Result && "structural differences second time around?"); + (void) Result; + + // Make the mapping non-tentative this time. + if (!LI->use_empty()) + Values[&*LI] = &*RI; + + ++LI, ++RI; + } while (LI != LE); } bool matchForBlockDiff(Instruction *L, Instruction *R); |