aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-01-30 16:18:47 +0100
committerNikita Popov <npopov@redhat.com>2025-01-30 16:28:19 +0100
commita3fdc36ac97fc7ed5e1e78564db8f58a6fa1103d (patch)
tree5b4373588da97f111811052c2515874c9794509a
parent9acaaebcdd39f7584a20388f1bad8a9f721bf9d0 (diff)
downloadllvm-a3fdc36ac97fc7ed5e1e78564db8f58a6fa1103d.zip
llvm-a3fdc36ac97fc7ed5e1e78564db8f58a6fa1103d.tar.gz
llvm-a3fdc36ac97fc7ed5e1e78564db8f58a6fa1103d.tar.bz2
[FunctionAttrs] Remove dead code code in nocaptures inference (NFCI)
An argument graph node without uses forms a trivial SCC, which will already be handled by the preceding branch. If a node in the SCC points to a node with empty uses, then it will be part of a different SCC, and as such assumed to be capturing if it does not have an attribute. There is no need to handle them separately.
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index f2419e4..cf56f67 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1296,16 +1296,6 @@ static void addArgumentAttrs(const SCCNodeSet &SCCNodes,
continue;
}
- bool SCCCaptured = false;
- for (ArgumentGraphNode *Node : ArgumentSCC) {
- if (Node->Uses.empty() && !Node->Definition->hasNoCaptureAttr()) {
- SCCCaptured = true;
- break;
- }
- }
- if (SCCCaptured)
- continue;
-
SmallPtrSet<Argument *, 8> ArgumentSCCNodes;
// Fill ArgumentSCCNodes with the elements of the ArgumentSCC. Used for
// quickly looking up whether a given Argument is in this ArgumentSCC.
@@ -1313,6 +1303,7 @@ static void addArgumentAttrs(const SCCNodeSet &SCCNodes,
ArgumentSCCNodes.insert(I->Definition);
}
+ bool SCCCaptured = false;
for (ArgumentGraphNode *N : ArgumentSCC) {
for (ArgumentGraphNode *Use : N->Uses) {
Argument *A = Use->Definition;