Skip to content

Commit

Permalink
Diagnose non-structural differences in the case where blocks were
Browse files Browse the repository at this point in the history
structurally identical.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109743 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rjmccall committed Jul 29, 2010
1 parent 02e116c commit e292143
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tools/llvm-diff/DifferenceEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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);
Expand Down

0 comments on commit e292143

Please sign in to comment.