diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2014-11-12 18:25:47 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2014-11-12 18:25:47 +0000 |
| commit | 4c219fd248e9e07dd884642dab6c579cfaf65fe6 (patch) | |
| tree | 4645c8724042f86d8ac4181d8a2fec64b84d0e2a /llvm/lib | |
| parent | a41cf018b896f05e78ba1c5a711edd8c1e59ad8d (diff) | |
| download | bcm5719-llvm-4c219fd248e9e07dd884642dab6c579cfaf65fe6.tar.gz bcm5719-llvm-4c219fd248e9e07dd884642dab6c579cfaf65fe6.zip | |
CGSCC should not treat intrinsic calls like function calls (PR21403)
Make the handling of calls to intrinsics in CGSCC consistent:
they are not treated like regular function calls because they
are never lowered to function calls.
Without this patch, we can get dangling pointer asserts from
the subsequent loop that processes callsites because it already
ignores intrinsics.
See http://llvm.org/bugs/show_bug.cgi?id=21403 for more details / discussion.
Differential Revision: http://reviews.llvm.org/D6124
llvm-svn: 221802
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp index c27edbfa2ff..665aa7f046e 100644 --- a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -243,7 +243,14 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC, assert(!CallSites.count(I->first) && "Call site occurs in node multiple times"); - CallSites.insert(std::make_pair(I->first, I->second)); + + CallSite CS(I->first); + if (CS) { + Function *Callee = CS.getCalledFunction(); + // Ignore intrinsics because they're not really function calls. + if (!Callee || !(Callee->isIntrinsic())) + CallSites.insert(std::make_pair(I->first, I->second)); + } ++I; } |

