aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-02-28 11:23:51 +0100
committerNikita Popov <npopov@redhat.com>2025-02-28 11:33:44 +0100
commit36f0838a3dd19de085d10f79cf0577d8bc4a1922 (patch)
tree2b313282c63c118fe34278dbcf96be38be272554 /llvm/lib/Transforms/IPO/FunctionAttrs.cpp
parent76910f914cdd4b86b28e0d5852155244ee47dc53 (diff)
downloadllvm-36f0838a3dd19de085d10f79cf0577d8bc4a1922.zip
llvm-36f0838a3dd19de085d10f79cf0577d8bc4a1922.tar.gz
llvm-36f0838a3dd19de085d10f79cf0577d8bc4a1922.tar.bz2
[FunctionAttrs] Consider non-willreturn functions during capture inference
Matching the CaptureTracking change in abd97d9685c07c4787ff22e56c0a7b8963630063, only directly infer captures(none) for readonly+nocapture+willreturn+void. Part of https://github.com/llvm/llvm-project/issues/129090.
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index f6e211c..5c17b9e 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1249,7 +1249,7 @@ static void addArgumentAttrs(const SCCNodeSet &SCCNodes,
// Functions that are readonly (or readnone) and nounwind and don't return
// a value can't capture arguments. Don't analyze them.
- if (F->onlyReadsMemory() && F->doesNotThrow() &&
+ if (F->onlyReadsMemory() && F->doesNotThrow() && F->willReturn() &&
F->getReturnType()->isVoidTy()) {
for (Argument &A : F->args()) {
if (A.getType()->isPointerTy() && !A.hasNoCaptureAttr()) {