[llvm-commits] [llvm] r109743 - /llvm/trunk/tools/llvm-diff/DifferenceEngine.cpp
John McCall
rjmccall at apple.com
Thu Jul 29 02:04:45 PDT 2010
Author: rjmccall
Date: Thu Jul 29 04:04:45 2010
New Revision: 109743
URL: http://llvm.org/viewvc/llvm-project?rev=109743&view=rev
Log:
Diagnose non-structural differences in the case where blocks were
structurally identical.
Modified:
llvm/trunk/tools/llvm-diff/DifferenceEngine.cpp
Modified: llvm/trunk/tools/llvm-diff/DifferenceEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-diff/DifferenceEngine.cpp?rev=109743&r1=109742&r2=109743&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-diff/DifferenceEngine.cpp (original)
+++ llvm/trunk/tools/llvm-diff/DifferenceEngine.cpp Thu Jul 29 04:04:45 2010
@@ -194,7 +194,7 @@
// 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 @@
} 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);
More information about the llvm-commits
mailing list