diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:01:25 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:01:25 +0000 |
commit | d8e91e46262bc44006913e6796843909f1ac7bcd (patch) | |
tree | 7d0c143d9b38190e0fa0180805389da22cd834c5 /tools/llvm-diff/DifferenceEngine.cpp | |
parent | b7eb8e35e481a74962664b63dfb09483b200209a (diff) |
Notes
Diffstat (limited to 'tools/llvm-diff/DifferenceEngine.cpp')
-rw-r--r-- | tools/llvm-diff/DifferenceEngine.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/tools/llvm-diff/DifferenceEngine.cpp b/tools/llvm-diff/DifferenceEngine.cpp index af0a055ea21f..acff8bb3e89b 100644 --- a/tools/llvm-diff/DifferenceEngine.cpp +++ b/tools/llvm-diff/DifferenceEngine.cpp @@ -629,8 +629,8 @@ void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart, // If the terminators have different kinds, but one is an invoke and the // other is an unconditional branch immediately following a call, unify // the results and the destinations. - TerminatorInst *LTerm = LStart->getParent()->getTerminator(); - TerminatorInst *RTerm = RStart->getParent()->getTerminator(); + Instruction *LTerm = LStart->getParent()->getTerminator(); + Instruction *RTerm = RStart->getParent()->getTerminator(); if (isa<BranchInst>(LTerm) && isa<InvokeInst>(RTerm)) { if (cast<BranchInst>(LTerm)->isConditional()) return; BasicBlock::iterator I = LTerm->getIterator(); @@ -686,9 +686,18 @@ void DifferenceEngine::diff(Module *L, Module *R) { StringSet<> LNames; SmallVector<std::pair<Function*,Function*>, 20> Queue; + unsigned LeftAnonCount = 0; + unsigned RightAnonCount = 0; + for (Module::iterator I = L->begin(), E = L->end(); I != E; ++I) { Function *LFn = &*I; - LNames.insert(LFn->getName()); + StringRef Name = LFn->getName(); + if (Name.empty()) { + ++LeftAnonCount; + continue; + } + + LNames.insert(Name); if (Function *RFn = R->getFunction(LFn->getName())) Queue.push_back(std::make_pair(LFn, RFn)); @@ -698,10 +707,25 @@ void DifferenceEngine::diff(Module *L, Module *R) { for (Module::iterator I = R->begin(), E = R->end(); I != E; ++I) { Function *RFn = &*I; - if (!LNames.count(RFn->getName())) + StringRef Name = RFn->getName(); + if (Name.empty()) { + ++RightAnonCount; + continue; + } + + if (!LNames.count(Name)) logf("function %r exists only in right module") << RFn; } + + if (LeftAnonCount != 0 || RightAnonCount != 0) { + SmallString<32> Tmp; + logf(("not comparing " + Twine(LeftAnonCount) + + " anonymous functions in the left module and " + + Twine(RightAnonCount) + " in the right module") + .toStringRef(Tmp)); + } + for (SmallVectorImpl<std::pair<Function*,Function*> >::iterator I = Queue.begin(), E = Queue.end(); I != E; ++I) diff(I->first, I->second); |