summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/Attributor.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2019-11-01 22:35:18 -0500
committerJohannes Doerfert <johannes@jdoerfert.de>2019-11-02 01:23:18 -0500
commit2d77b0cad008eee612e3845769d8b08455a2176c (patch)
tree159c81e27ff5b597ba39b67d804f01dc3fa70df7 /llvm/lib/Transforms/IPO/Attributor.cpp
parent4c56086f8b458bbe8300b0cbd59baaf46ea38d7c (diff)
downloadbcm5719-llvm-2d77b0cad008eee612e3845769d8b08455a2176c.tar.gz
bcm5719-llvm-2d77b0cad008eee612e3845769d8b08455a2176c.zip
[Attributor] Ignore BlockAddress users in call site traversal
BlockAddress users will not "call" the function so they do not qualify as call sites in the first place. When we delete a function with BlockAddress users we need to first remove the body so they are properly discarded.
Diffstat (limited to 'llvm/lib/Transforms/IPO/Attributor.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 5082aa26dba..29dc80ae591 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -4658,6 +4658,9 @@ bool Attributor::checkForAllCallSites(
<< Fn.getName()
<< " has non call site use " << *U.get() << " in "
<< *U.getUser() << "\n");
+ // BlockAddress users are allowed.
+ if (isa<BlockAddress>(U.getUser()))
+ continue;
return false;
}
@@ -5072,6 +5075,7 @@ ChangeStatus Attributor::run(Module &M) {
STATS_TRACK(AAIsDead, Function);
ToBeDeletedFunctions.insert(F);
+ F->deleteBody();
F->replaceAllUsesWith(UndefValue::get(F->getType()));
F->eraseFromParent();
InternalFns[u] = nullptr;
OpenPOWER on IntegriCloud