summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-diff/DifferenceEngine.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-07-29 09:04:45 +0000
committerJohn McCall <rjmccall@apple.com>2010-07-29 09:04:45 +0000
commit8489de298e41421a504cab8f11701971d757d709 (patch)
tree5b40fc4960418118123714bf8ba070feada9bca1 /llvm/tools/llvm-diff/DifferenceEngine.cpp
parent0ed6b1326c9021edccc37ce69511990f81453ee6 (diff)
downloadbcm5719-llvm-8489de298e41421a504cab8f11701971d757d709.tar.gz
bcm5719-llvm-8489de298e41421a504cab8f11701971d757d709.zip
Diagnose non-structural differences in the case where blocks were
structurally identical. llvm-svn: 109743
Diffstat (limited to 'llvm/tools/llvm-diff/DifferenceEngine.cpp')
-rw-r--r--llvm/tools/llvm-diff/DifferenceEngine.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/llvm/tools/llvm-diff/DifferenceEngine.cpp b/llvm/tools/llvm-diff/DifferenceEngine.cpp
index d9fbc57d2d7..764b56a296a 100644
--- a/llvm/tools/llvm-diff/DifferenceEngine.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud