[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.
This commit is contained in:
Nikita Popov 2025-01-29 17:27:25 +01:00
parent 35defdf470
commit 8a43d0e873
3 changed files with 4 additions and 3 deletions

View File

@ -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 ||

View File

@ -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)

View File

@ -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)