aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-08-19 16:37:40 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-08-19 16:37:40 +0000
commit5554edabef3814395360c37e9854fa4aa7b1731e (patch)
tree33f153ab299f5c7c5bcbf6baccea3d41d5692c2b /llvm/lib/Transforms/Utils/CloneFunction.cpp
parent9335bf0ec5c19bbaf027847682c44451b6affef8 (diff)
downloadllvm-5554edabef3814395360c37e9854fa4aa7b1731e.zip
llvm-5554edabef3814395360c37e9854fa4aa7b1731e.tar.gz
llvm-5554edabef3814395360c37e9854fa4aa7b1731e.tar.bz2
[CloneFunction] Don't remove unrelated nodes from the CGSSC
CGSCC use a WeakVH to track call sites. RAUW a call within a function can result in that WeakVH getting confused about whether or not the call site is still around. llvm-svn: 279268
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 4f1052d..4d33e22 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -566,6 +566,12 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc,
if (!I)
continue;
+ // Skip over non-intrinsic callsites, we don't want to remove any nodes from
+ // the CGSCC.
+ CallSite CS = CallSite(I);
+ if (CS && CS.getCalledFunction() && !CS.getCalledFunction()->isIntrinsic())
+ continue;
+
// See if this instruction simplifies.
Value *SimpleV = SimplifyInstruction(I, DL);
if (!SimpleV)