projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merging r259177:
[oota-llvm.git]
/
tools
/
llvm-diff
/
DifferenceEngine.cpp
diff --git
a/tools/llvm-diff/DifferenceEngine.cpp
b/tools/llvm-diff/DifferenceEngine.cpp
index ba2cec2992554bbd942207b283658bb115fc9394..456560b093aba55fdaeadbceb7f0ceb42ad2e1c1 100644
(file)
--- a/
tools/llvm-diff/DifferenceEngine.cpp
+++ b/
tools/llvm-diff/DifferenceEngine.cpp
@@
-13,22
+13,20
@@
//===----------------------------------------------------------------------===//
#include "DifferenceEngine.h"
//===----------------------------------------------------------------------===//
#include "DifferenceEngine.h"
-
-#include "llvm/Constants.h"
-#include "llvm/Function.h"
-#include "llvm/Instructions.h"
-#include "llvm/Module.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
-#include "llvm/Support/CallSite.h"
-#include "llvm/Support/CFG.h"
+#include "llvm/IR/CFG.h"
+#include "llvm/IR/CallSite.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Module.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/type_traits.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/type_traits.h"
-
#include <utility>
using namespace llvm;
#include <utility>
using namespace llvm;
@@
-195,12
+193,10
@@
class FunctionDifferenceEngine {
DifferenceEngine::Context C(Engine, L, R);
BasicBlock::iterator LI = L->begin(), LE = L->end();
DifferenceEngine::Context C(Engine, L, R);
BasicBlock::iterator LI = L->begin(), LE = L->end();
- BasicBlock::iterator RI = R->begin(), RE = R->end();
-
- llvm::SmallVector<std::pair<Instruction*,Instruction*>, 20> TentativePairs;
+ BasicBlock::iterator RI = R->begin();
do {
do {
- assert(LI != LE && RI != R
E
);
+ assert(LI != LE && RI != R
->end()
);
Instruction *LeftI = &*LI, *RightI = &*RI;
// If the instructions differ, start the more sophisticated diff
Instruction *LeftI = &*LI, *RightI = &*RI;
// If the instructions differ, start the more sophisticated diff
@@
-319,15
+315,19
@@
class FunctionDifferenceEngine {
bool Difference = false;
DenseMap<ConstantInt*,BasicBlock*> LCases;
bool Difference = false;
DenseMap<ConstantInt*,BasicBlock*> LCases;
- for (unsigned I = 1, E = LI->getNumCases(); I != E; ++I)
- LCases[LI->getCaseValue(I)] = LI->getSuccessor(I);
- for (unsigned I = 1, E = RI->getNumCases(); I != E; ++I) {
- ConstantInt *CaseValue = RI->getCaseValue(I);
+
+ for (SwitchInst::CaseIt I = LI->case_begin(), E = LI->case_end();
+ I != E; ++I)
+ LCases[I.getCaseValue()] = I.getCaseSuccessor();
+
+ for (SwitchInst::CaseIt I = RI->case_begin(), E = RI->case_end();
+ I != E; ++I) {
+ ConstantInt *CaseValue = I.getCaseValue();
BasicBlock *LCase = LCases[CaseValue];
if (LCase) {
BasicBlock *LCase = LCases[CaseValue];
if (LCase) {
- if (TryUnify) tryUnify(LCase,
RI->getSuccessor(I
));
+ if (TryUnify) tryUnify(LCase,
I.getCaseSuccessor(
));
LCases.erase(CaseValue);
LCases.erase(CaseValue);
- } else if (!Difference) {
+ } else if (
Complain ||
!Difference) {
if (Complain)
Engine.logf("right switch has extra case %r") << CaseValue;
Difference = true;
if (Complain)
Engine.logf("right switch has extra case %r") << CaseValue;
Difference = true;
@@
-599,7
+599,7
@@
void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart,
TerminatorInst *RTerm = RStart->getParent()->getTerminator();
if (isa<BranchInst>(LTerm) && isa<InvokeInst>(RTerm)) {
if (cast<BranchInst>(LTerm)->isConditional()) return;
TerminatorInst *RTerm = RStart->getParent()->getTerminator();
if (isa<BranchInst>(LTerm) && isa<InvokeInst>(RTerm)) {
if (cast<BranchInst>(LTerm)->isConditional()) return;
- BasicBlock::iterator I = LTerm;
+ BasicBlock::iterator I = LTerm
->getIterator()
;
if (I == LStart->getParent()->begin()) return;
--I;
if (!isa<CallInst>(*I)) return;
if (I == LStart->getParent()->begin()) return;
--I;
if (!isa<CallInst>(*I)) return;
@@
-612,7
+612,7
@@
void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart,
tryUnify(LTerm->getSuccessor(0), RInvoke->getNormalDest());
} else if (isa<InvokeInst>(LTerm) && isa<BranchInst>(RTerm)) {
if (cast<BranchInst>(RTerm)->isConditional()) return;
tryUnify(LTerm->getSuccessor(0), RInvoke->getNormalDest());
} else if (isa<InvokeInst>(LTerm) && isa<BranchInst>(RTerm)) {
if (cast<BranchInst>(RTerm)->isConditional()) return;
- BasicBlock::iterator I = RTerm;
+ BasicBlock::iterator I = RTerm
->getIterator()
;
if (I == RStart->getParent()->begin()) return;
--I;
if (!isa<CallInst>(*I)) return;
if (I == RStart->getParent()->begin()) return;
--I;
if (!isa<CallInst>(*I)) return;
@@
-628,6
+628,8
@@
void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart,
}
}
+void DifferenceEngine::Oracle::anchor() { }
+
void DifferenceEngine::diff(Function *L, Function *R) {
Context C(*this, L, R);
void DifferenceEngine::diff(Function *L, Function *R) {
Context C(*this, L, R);