Improve RefreshCallGraph to remove invalid call graph edge.
With commit r219944, InstCombine can now turn a sqrtl into a llvm.fabs.f64. The call graph edge originally representing the call to sqrtl becomes invalid. This patch modifies CGPassManager::RefreshCallGraph() to remove the invalid call graph edge, which can triggers an assert in CallGraphNode::addCalledFunction(). Phabricator Review: http://reviews.llvm.org/D7705 Patch by Lawrence Hu <lawrence@codeaurora.org>. llvm-svn: 234902
This commit is contained in:
parent
fb37cfa346
commit
7a20ed7627
|
@ -212,10 +212,13 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC,
|
||||||
// list of the same call.
|
// list of the same call.
|
||||||
CallSites.count(I->first) ||
|
CallSites.count(I->first) ||
|
||||||
|
|
||||||
// If the call edge is not from a call or invoke, then the function
|
// If the call edge is not from a call or invoke, or it is a
|
||||||
// pass RAUW'd a call with another value. This can happen when
|
// instrinsic call, then the function pass RAUW'd a call with
|
||||||
// constant folding happens of well known functions etc.
|
// another value. This can happen when constant folding happens
|
||||||
!CallSite(I->first)) {
|
// of well known functions etc.
|
||||||
|
!CallSite(I->first) ||
|
||||||
|
(CallSite(I->first).getCalledFunction() &&
|
||||||
|
CallSite(I->first).getCalledFunction()->isIntrinsic())) {
|
||||||
assert(!CheckingMode &&
|
assert(!CheckingMode &&
|
||||||
"CallGraphSCCPass did not update the CallGraph correctly!");
|
"CallGraphSCCPass did not update the CallGraph correctly!");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue