diff options
author | Sanjay Patel <spatel@rotateright.com> | 2015-03-11 15:12:32 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2015-03-11 15:12:32 +0000 |
commit | c04b6f242ca4a16165bea8043c2cdc19407cf240 (patch) | |
tree | f62aecfd8c12354d5c6511b31b4b59db4b84d119 /llvm/lib | |
parent | 8c68a64ec847fc7ebe2fc5ad4410f6c84b02cddc (diff) | |
download | bcm5719-llvm-c04b6f242ca4a16165bea8043c2cdc19407cf240.tar.gz bcm5719-llvm-c04b6f242ca4a16165bea8043c2cdc19407cf240.zip |
Inliner should not add callgraph edges for intrinsic calls (PR22857)
The CallGraphNode function "addCalledFunction()" asserts that edges are not to intrinsics.
This patch makes sure that the Inliner does not add such an edge to the callgraph.
Fix for clang crash by assertion: https://llvm.org/bugs/show_bug.cgi?id=22857
Differential Revision: http://reviews.llvm.org/D8231
llvm-svn: 231927
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 76da677d74f..df3e1d4a47d 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -693,8 +693,15 @@ static void UpdateCallGraphAfterInlining(CallSite CS, // If the call was inlined, but then constant folded, there is no edge to // add. Check for this case. Instruction *NewCall = dyn_cast<Instruction>(VMI->second); - if (!NewCall) continue; + if (!NewCall) + continue; + // We do not treat intrinsic calls like real function calls because we + // expect them to become inline code; do not add an edge for an intrinsic. + CallSite CS = CallSite(NewCall); + if (CS && CS.getCalledFunction() && CS.getCalledFunction()->isIntrinsic()) + continue; + // Remember that this call site got inlined for the client of // InlineFunction. IFI.InlinedCalls.push_back(NewCall); |