Skip to content

Commit

Permalink
Merged master:1becd298b82e into amd-gfx:3ee91d2f67ad
Browse files Browse the repository at this point in the history
Local branch amd-gfx 3ee91d2 Merged master:a28d38a6bca1 into amd-gfx:97deb2a587ec
Remote branch master 1becd29 [NFC] CallGraph related cleanup
  • Loading branch information
Sw authored and Sw committed Jun 28, 2020
2 parents 3ee91d2 + 1becd29 commit 42ca388
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/CallGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class CallGraphWrapperPass : public ModulePass {
// graphs by the generic graph algorithms.
//

// Provide graph traits for tranversing call graphs using standard graph
// Provide graph traits for traversing call graphs using standard graph
// traversals.
template <> struct GraphTraits<CallGraphNode *> {
using NodeRef = CallGraphNode *;
Expand Down
10 changes: 4 additions & 6 deletions llvm/lib/Analysis/CallGraphSCCPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,16 @@ bool CGPassManager::RefreshCallGraph(const CallGraphSCC &CurSCC, CallGraph &CG,
// If this call site is null, then the function pass deleted the call
// entirely and the WeakTrackingVH nulled it out.
auto *Call = dyn_cast_or_null<CallBase>(I->first);
if (!I->first ||
if (!Call ||
// If we've already seen this call site, then the FunctionPass RAUW'd
// one call with another, which resulted in two "uses" in the edge
// list of the same call.
Calls.count(I->first) ||
Calls.count(Call) ||

// If the call edge is not from a call or invoke, or it is a
// instrinsic call, then the function pass RAUW'd a call with
// another value. This can happen when constant folding happens
// of well known functions etc.
!Call ||
(Call->getCalledFunction() &&
Call->getCalledFunction()->isIntrinsic() &&
Intrinsic::isLeaf(Call->getCalledFunction()->getIntrinsicID()))) {
Expand All @@ -267,14 +266,13 @@ bool CGPassManager::RefreshCallGraph(const CallGraphSCC &CurSCC, CallGraph &CG,
continue;
}

assert(!Calls.count(I->first) &&
"Call site occurs in node multiple times");
assert(!Calls.count(Call) && "Call site occurs in node multiple times");

if (Call) {
Function *Callee = Call->getCalledFunction();
// Ignore intrinsics because they're not really function calls.
if (!Callee || !(Callee->isIntrinsic()))
Calls.insert(std::make_pair(I->first, I->second));
Calls.insert(std::make_pair(Call, I->second));
}
++I;
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ PreservedAnalyses SyntheticCountsPropagation::run(Module &M,
Optional<Scaled64> Res = None;
if (!Edge.first)
return Res;
assert(isa<Instruction>(Edge.first));
CallBase &CB = cast<CallBase>(*Edge.first);
CallBase &CB = *cast<CallBase>(Edge.first);
Function *Caller = CB.getCaller();
auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(*Caller);

Expand Down

0 comments on commit 42ca388

Please sign in to comment.