diff options
author | Nikita Popov <npopov@redhat.com> | 2025-01-29 17:27:25 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2025-01-29 17:34:10 +0100 |
commit | 8a43d0e8736cf5e0f95a5f02c9b6855a703b2e4e (patch) | |
tree | 17db0005e20b1544c86df50d4929b04462e6bcda | |
parent | 35defdf4707dfa58802188d2aad1298cddb44cb6 (diff) | |
download | llvm-8a43d0e8736cf5e0f95a5f02c9b6855a703b2e4e.zip llvm-8a43d0e8736cf5e0f95a5f02c9b6855a703b2e4e.tar.gz llvm-8a43d0e8736cf5e0f95a5f02c9b6855a703b2e4e.tar.bz2 |
[Attributor] Check correct IRPosition in AANoCapture::isImpliedByIR()
This case is intended to check the callee argument, not the call-site.
Fixes an issue introduced in #123181.
-rw-r--r-- | llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 3 | ||||
-rw-r--r-- | llvm/test/Transforms/Attributor/liveness.ll | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/Attributor/nonnull.ll | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 77f2e1c..17e7fad 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -5752,7 +5752,8 @@ bool AANoCapture::isImpliedByIR(Attributor &A, const IRPosition &IRP, if (IRP.getPositionKind() == IRP_CALL_SITE_ARGUMENT) if (Argument *Arg = IRP.getAssociatedArgument()) { SmallVector<Attribute, 1> Attrs; - A.getAttrs(IRP, {Attribute::Captures, Attribute::ByVal}, Attrs, + A.getAttrs(IRPosition::argument(*Arg), + {Attribute::Captures, Attribute::ByVal}, Attrs, /* IgnoreSubsumingPositions */ true); bool ArgNoCapture = any_of(Attrs, [](Attribute Attr) { return Attr.getKindAsEnum() == Attribute::ByVal || diff --git a/llvm/test/Transforms/Attributor/liveness.ll b/llvm/test/Transforms/Attributor/liveness.ll index 8830df6..874eff6 100644 --- a/llvm/test/Transforms/Attributor/liveness.ll +++ b/llvm/test/Transforms/Attributor/liveness.ll @@ -2364,7 +2364,7 @@ define internal void @call_via_pointer_with_dead_args_internal_a(ptr %a, ptr %b, ; ; CGSCC-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a ; CGSCC-SAME: (ptr [[A:%.*]], ptr noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) { -; CGSCC-NEXT: call void @called_via_pointer(ptr [[A]], ptr nofree noundef nonnull align 128 dereferenceable(4) [[B]], ptr nofree [[A]], i64 noundef -1, ptr nofree noundef null) +; CGSCC-NEXT: call void @called_via_pointer(ptr [[A]], ptr nofree noundef nonnull align 128 captures(none) dereferenceable(4) [[B]], ptr nofree captures(none) [[A]], i64 noundef -1, ptr nofree noundef null) ; CGSCC-NEXT: ret void ; call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null) diff --git a/llvm/test/Transforms/Attributor/nonnull.ll b/llvm/test/Transforms/Attributor/nonnull.ll index c22f1f3..efe2f06 100644 --- a/llvm/test/Transforms/Attributor/nonnull.ll +++ b/llvm/test/Transforms/Attributor/nonnull.ll @@ -1058,7 +1058,7 @@ define internal void @optnone(ptr dereferenceable(4) %a) optnone noinline { ; CHECK: Function Attrs: noinline optnone ; CHECK-LABEL: define {{[^@]+}}@optnone ; CHECK-SAME: (ptr noundef nonnull dereferenceable(4) [[A:%.*]]) #[[ATTR12:[0-9]+]] { -; CHECK-NEXT: call void @use_i32_ptr(ptr nofree noundef nonnull [[A]]) +; CHECK-NEXT: call void @use_i32_ptr(ptr nofree noundef nonnull captures(none) [[A]]) ; CHECK-NEXT: ret void ; call void @use_i32_ptr(ptr %a) |