Skip to content

Commit 8a43d0e

Browse files
committed
[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.
1 parent 35defdf commit 8a43d0e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -5752,7 +5752,8 @@ bool AANoCapture::isImpliedByIR(Attributor &A, const IRPosition &IRP,
57525752
if (IRP.getPositionKind() == IRP_CALL_SITE_ARGUMENT)
57535753
if (Argument *Arg = IRP.getAssociatedArgument()) {
57545754
SmallVector<Attribute, 1> Attrs;
5755-
A.getAttrs(IRP, {Attribute::Captures, Attribute::ByVal}, Attrs,
5755+
A.getAttrs(IRPosition::argument(*Arg),
5756+
{Attribute::Captures, Attribute::ByVal}, Attrs,
57565757
/* IgnoreSubsumingPositions */ true);
57575758
bool ArgNoCapture = any_of(Attrs, [](Attribute Attr) {
57585759
return Attr.getKindAsEnum() == Attribute::ByVal ||

llvm/test/Transforms/Attributor/liveness.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,7 @@ define internal void @call_via_pointer_with_dead_args_internal_a(ptr %a, ptr %b,
23642364
;
23652365
; CGSCC-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a
23662366
; CGSCC-SAME: (ptr [[A:%.*]], ptr noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {
2367-
; 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)
2367+
; 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)
23682368
; CGSCC-NEXT: ret void
23692369
;
23702370
call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null)

llvm/test/Transforms/Attributor/nonnull.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ define internal void @optnone(ptr dereferenceable(4) %a) optnone noinline {
10581058
; CHECK: Function Attrs: noinline optnone
10591059
; CHECK-LABEL: define {{[^@]+}}@optnone
10601060
; CHECK-SAME: (ptr noundef nonnull dereferenceable(4) [[A:%.*]]) #[[ATTR12:[0-9]+]] {
1061-
; CHECK-NEXT: call void @use_i32_ptr(ptr nofree noundef nonnull [[A]])
1061+
; CHECK-NEXT: call void @use_i32_ptr(ptr nofree noundef nonnull captures(none) [[A]])
10621062
; CHECK-NEXT: ret void
10631063
;
10641064
call void @use_i32_ptr(ptr %a)

0 commit comments

Comments
 (0)