Skip to content

Commit 733640d

Browse files
authored
Attributor: Handle inferring align from use by atomics (#85762)
1 parent 35d3b34 commit 733640d

File tree

4 files changed

+151
-32
lines changed

4 files changed

+151
-32
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5190,6 +5190,12 @@ static unsigned getKnownAlignForUse(Attributor &A, AAAlign &QueryingAA,
51905190
} else if (auto *LI = dyn_cast<LoadInst>(I)) {
51915191
if (LI->getPointerOperand() == UseV)
51925192
MA = LI->getAlign();
5193+
} else if (auto *AI = dyn_cast<AtomicRMWInst>(I)) {
5194+
if (AI->getPointerOperand() == UseV)
5195+
MA = AI->getAlign();
5196+
} else if (auto *AI = dyn_cast<AtomicCmpXchgInst>(I)) {
5197+
if (AI->getPointerOperand() == UseV)
5198+
MA = AI->getAlign();
51935199
}
51945200

51955201
if (!MA || *MA <= QueryingAA.getKnownAlign())

llvm/test/Transforms/Attributor/align.ll

Lines changed: 138 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1111
; TEST 1
1212
;;
1313
;.
14-
; CHECK: @[[A1:[a-zA-Z0-9_$"\\.-]+]] = common global i8 0, align 8
15-
; CHECK: @[[A2:[a-zA-Z0-9_$"\\.-]+]] = common global i8 0, align 16
16-
; CHECK: @[[CND:[a-zA-Z0-9_$"\\.-]+]] = external global i1
17-
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = global i8 0, align 32
14+
; CHECK: @a1 = common global i8 0, align 8
15+
; CHECK: @a2 = common global i8 0, align 16
16+
; CHECK: @cnd = external global i1
17+
; CHECK: @G = global i8 0, align 32
1818
;.
1919
define ptr @test1(ptr align 8 %0) #0 {
2020
; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable
@@ -158,18 +158,31 @@ define internal ptr @f1(ptr readnone %0) local_unnamed_addr #0 {
158158

159159
; Function Attrs: nounwind readnone ssp uwtable
160160
define ptr @f2(ptr readnone %0) local_unnamed_addr #0 {
161-
; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable
162-
; CHECK-LABEL: define {{[^@]+}}@f2
163-
; CHECK-SAME: (ptr nofree readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
164-
; CHECK-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
165-
; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
166-
; CHECK: 3:
167-
; CHECK-NEXT: br label [[TMP5:%.*]]
168-
; CHECK: 4:
169-
; CHECK-NEXT: br label [[TMP5]]
170-
; CHECK: 5:
171-
; CHECK-NEXT: [[TMP6:%.*]] = phi ptr [ [[TMP0]], [[TMP3]] ], [ @a1, [[TMP4]] ]
172-
; CHECK-NEXT: ret ptr [[TMP6]]
161+
; TUNIT: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable
162+
; TUNIT-LABEL: define {{[^@]+}}@f2
163+
; TUNIT-SAME: (ptr nofree readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
164+
; TUNIT-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
165+
; TUNIT-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
166+
; TUNIT: 3:
167+
; TUNIT-NEXT: br label [[TMP5:%.*]]
168+
; TUNIT: 4:
169+
; TUNIT-NEXT: br label [[TMP5]]
170+
; TUNIT: 5:
171+
; TUNIT-NEXT: [[TMP6:%.*]] = phi ptr [ [[TMP0]], [[TMP3]] ], [ @a1, [[TMP4]] ]
172+
; TUNIT-NEXT: ret ptr [[TMP6]]
173+
;
174+
; CGSCC: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable
175+
; CGSCC-LABEL: define {{[^@]+}}@f2
176+
; CGSCC-SAME: (ptr nofree readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
177+
; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
178+
; CGSCC-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
179+
; CGSCC: 3:
180+
; CGSCC-NEXT: br label [[TMP5:%.*]]
181+
; CGSCC: 4:
182+
; CGSCC-NEXT: br label [[TMP5]]
183+
; CGSCC: 5:
184+
; CGSCC-NEXT: [[TMP6:%.*]] = phi ptr [ [[TMP0]], [[TMP3]] ], [ @a1, [[TMP4]] ]
185+
; CGSCC-NEXT: ret ptr [[TMP6]]
173186
;
174187
%2 = icmp eq ptr %0, null
175188
br i1 %2, label %5, label %3
@@ -222,7 +235,7 @@ define align 4 ptr @test7() #0 {
222235
; CGSCC: Function Attrs: mustprogress nofree noinline nosync nounwind willreturn memory(none) uwtable
223236
; CGSCC-LABEL: define {{[^@]+}}@test7
224237
; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {
225-
; CGSCC-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) ptr @f1() #[[ATTR14:[0-9]+]]
238+
; CGSCC-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) ptr @f1() #[[ATTR15:[0-9]+]]
226239
; CGSCC-NEXT: ret ptr [[C]]
227240
;
228241
%c = tail call ptr @f1(ptr align 8 dereferenceable(1) @a1)
@@ -933,7 +946,7 @@ define i32 @musttail_caller_1(ptr %p) {
933946
; TUNIT-NEXT: [[C:%.*]] = load i1, ptr @cnd, align 1
934947
; TUNIT-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]
935948
; TUNIT: mt:
936-
; TUNIT-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef readonly [[P]]) #[[ATTR12:[0-9]+]]
949+
; TUNIT-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef readonly [[P]]) #[[ATTR13:[0-9]+]]
937950
; TUNIT-NEXT: ret i32 [[V]]
938951
; TUNIT: exit:
939952
; TUNIT-NEXT: ret i32 0
@@ -944,7 +957,7 @@ define i32 @musttail_caller_1(ptr %p) {
944957
; CGSCC-NEXT: [[C:%.*]] = load i1, ptr @cnd, align 1
945958
; CGSCC-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]
946959
; CGSCC: mt:
947-
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR15:[0-9]+]]
960+
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR16:[0-9]+]]
948961
; CGSCC-NEXT: ret i32 [[V]]
949962
; CGSCC: exit:
950963
; CGSCC-NEXT: ret i32 0
@@ -1076,13 +1089,13 @@ define ptr @aligned_8_return_caller(ptr align(16) %a, i1 %c1, i1 %c2) {
10761089
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
10771090
; TUNIT-LABEL: define {{[^@]+}}@aligned_8_return_caller
10781091
; TUNIT-SAME: (ptr nofree readnone align 16 "no-capture-maybe-returned" [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR10]] {
1079-
; TUNIT-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 noundef [[C1]], i1 [[C2]]) #[[ATTR13:[0-9]+]]
1092+
; TUNIT-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 noundef [[C1]], i1 [[C2]]) #[[ATTR14:[0-9]+]]
10801093
; TUNIT-NEXT: ret ptr [[R]]
10811094
;
10821095
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
10831096
; CGSCC-LABEL: define {{[^@]+}}@aligned_8_return_caller
10841097
; CGSCC-SAME: (ptr nofree readnone align 16 [[A:%.*]], i1 noundef [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR13:[0-9]+]] {
1085-
; CGSCC-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 [[A]], i1 noundef [[C1]], i1 [[C2]]) #[[ATTR14]]
1098+
; CGSCC-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 [[A]], i1 noundef [[C1]], i1 [[C2]]) #[[ATTR15]]
10861099
; CGSCC-NEXT: ret ptr [[R]]
10871100
;
10881101
%r = call ptr @aligned_8_return(ptr %a, i1 %c1, i1 %c2)
@@ -1101,6 +1114,104 @@ entry:
11011114
ret i32 0
11021115
}
11031116

1117+
define i64 @infer_align_atomicrmw(ptr align 4 %p) {
1118+
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1119+
; TUNIT-LABEL: define {{[^@]+}}@infer_align_atomicrmw
1120+
; TUNIT-SAME: (ptr nocapture nofree align 16 [[P:%.*]]) #[[ATTR12:[0-9]+]] {
1121+
; TUNIT-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1122+
; TUNIT-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1123+
; TUNIT-NEXT: [[RET:%.*]] = atomicrmw add ptr [[ARRAYIDX1]], i64 4 seq_cst, align 16
1124+
; TUNIT-NEXT: ret i64 [[RET]]
1125+
;
1126+
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1127+
; CGSCC-LABEL: define {{[^@]+}}@infer_align_atomicrmw
1128+
; CGSCC-SAME: (ptr nocapture nofree align 16 [[P:%.*]]) #[[ATTR14:[0-9]+]] {
1129+
; CGSCC-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1130+
; CGSCC-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1131+
; CGSCC-NEXT: [[RET:%.*]] = atomicrmw add ptr [[ARRAYIDX1]], i64 4 seq_cst, align 16
1132+
; CGSCC-NEXT: ret i64 [[RET]]
1133+
;
1134+
%arrayidx0 = getelementptr i64, ptr %p, i64 1
1135+
%arrayidx1 = getelementptr i64, ptr %arrayidx0, i64 3
1136+
%ret = atomicrmw add ptr %arrayidx1, i64 4 seq_cst, align 16
1137+
ret i64 %ret
1138+
}
1139+
1140+
define ptr @infer_align_atomicrmw_ptr(ptr align 4 %p, ptr %val) {
1141+
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1142+
; TUNIT-LABEL: define {{[^@]+}}@infer_align_atomicrmw_ptr
1143+
; TUNIT-SAME: (ptr nocapture nofree align 16 [[P:%.*]], ptr nofree [[VAL:%.*]]) #[[ATTR12]] {
1144+
; TUNIT-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1145+
; TUNIT-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1146+
; TUNIT-NEXT: [[RET:%.*]] = atomicrmw xchg ptr [[ARRAYIDX1]], ptr [[VAL]] seq_cst, align 16
1147+
; TUNIT-NEXT: ret ptr [[RET]]
1148+
;
1149+
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1150+
; CGSCC-LABEL: define {{[^@]+}}@infer_align_atomicrmw_ptr
1151+
; CGSCC-SAME: (ptr nocapture nofree align 16 [[P:%.*]], ptr nofree [[VAL:%.*]]) #[[ATTR14]] {
1152+
; CGSCC-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1153+
; CGSCC-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1154+
; CGSCC-NEXT: [[RET:%.*]] = atomicrmw xchg ptr [[ARRAYIDX1]], ptr [[VAL]] seq_cst, align 16
1155+
; CGSCC-NEXT: ret ptr [[RET]]
1156+
;
1157+
%arrayidx0 = getelementptr i64, ptr %p, i64 1
1158+
%arrayidx1 = getelementptr i64, ptr %arrayidx0, i64 3
1159+
%ret = atomicrmw xchg ptr %arrayidx1, ptr %val seq_cst, align 16
1160+
ret ptr %ret
1161+
}
1162+
1163+
define i64 @infer_align_cmpxchg(ptr align 4 %p) {
1164+
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1165+
; TUNIT-LABEL: define {{[^@]+}}@infer_align_cmpxchg
1166+
; TUNIT-SAME: (ptr nocapture nofree align 16 [[P:%.*]]) #[[ATTR12]] {
1167+
; TUNIT-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1168+
; TUNIT-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1169+
; TUNIT-NEXT: [[CMPX:%.*]] = cmpxchg ptr [[ARRAYIDX1]], i64 4, i64 1 seq_cst seq_cst, align 16
1170+
; TUNIT-NEXT: [[RET:%.*]] = extractvalue { i64, i1 } [[CMPX]], 0
1171+
; TUNIT-NEXT: ret i64 [[RET]]
1172+
;
1173+
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1174+
; CGSCC-LABEL: define {{[^@]+}}@infer_align_cmpxchg
1175+
; CGSCC-SAME: (ptr nocapture nofree align 16 [[P:%.*]]) #[[ATTR14]] {
1176+
; CGSCC-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1177+
; CGSCC-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1178+
; CGSCC-NEXT: [[CMPX:%.*]] = cmpxchg ptr [[ARRAYIDX1]], i64 4, i64 1 seq_cst seq_cst, align 16
1179+
; CGSCC-NEXT: [[RET:%.*]] = extractvalue { i64, i1 } [[CMPX]], 0
1180+
; CGSCC-NEXT: ret i64 [[RET]]
1181+
;
1182+
%arrayidx0 = getelementptr i64, ptr %p, i64 1
1183+
%arrayidx1 = getelementptr i64, ptr %arrayidx0, i64 3
1184+
%cmpx = cmpxchg ptr %arrayidx1, i64 4, i64 1 seq_cst seq_cst, align 16
1185+
%ret = extractvalue { i64, i1 } %cmpx, 0
1186+
ret i64 %ret
1187+
}
1188+
1189+
define ptr @infer_align_cmpxchg_ptr(ptr align 4 %p, ptr %cmp0, ptr %cmp1) {
1190+
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1191+
; TUNIT-LABEL: define {{[^@]+}}@infer_align_cmpxchg_ptr
1192+
; TUNIT-SAME: (ptr nocapture nofree align 16 [[P:%.*]], ptr nofree [[CMP0:%.*]], ptr nofree [[CMP1:%.*]]) #[[ATTR12]] {
1193+
; TUNIT-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1194+
; TUNIT-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1195+
; TUNIT-NEXT: [[CMPX:%.*]] = cmpxchg ptr [[ARRAYIDX1]], ptr [[CMP0]], ptr [[CMP1]] seq_cst seq_cst, align 16
1196+
; TUNIT-NEXT: [[RET:%.*]] = extractvalue { ptr, i1 } [[CMPX]], 0
1197+
; TUNIT-NEXT: ret ptr [[RET]]
1198+
;
1199+
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
1200+
; CGSCC-LABEL: define {{[^@]+}}@infer_align_cmpxchg_ptr
1201+
; CGSCC-SAME: (ptr nocapture nofree align 16 [[P:%.*]], ptr nofree [[CMP0:%.*]], ptr nofree [[CMP1:%.*]]) #[[ATTR14]] {
1202+
; CGSCC-NEXT: [[ARRAYIDX0:%.*]] = getelementptr i64, ptr [[P]], i64 1
1203+
; CGSCC-NEXT: [[ARRAYIDX1:%.*]] = getelementptr i64, ptr [[ARRAYIDX0]], i64 3
1204+
; CGSCC-NEXT: [[CMPX:%.*]] = cmpxchg ptr [[ARRAYIDX1]], ptr [[CMP0]], ptr [[CMP1]] seq_cst seq_cst, align 16
1205+
; CGSCC-NEXT: [[RET:%.*]] = extractvalue { ptr, i1 } [[CMPX]], 0
1206+
; CGSCC-NEXT: ret ptr [[RET]]
1207+
;
1208+
%arrayidx0 = getelementptr i64, ptr %p, i64 1
1209+
%arrayidx1 = getelementptr i64, ptr %arrayidx0, i64 3
1210+
%cmpx = cmpxchg ptr %arrayidx1, ptr %cmp0, ptr %cmp1 seq_cst seq_cst, align 16
1211+
%ret = extractvalue { ptr, i1 } %cmpx, 0
1212+
ret ptr %ret
1213+
}
1214+
11041215
declare void @implicit_cast_callee(i64)
11051216

11061217
attributes #0 = { nounwind uwtable noinline }
@@ -1119,8 +1230,9 @@ attributes #2 = { null_pointer_is_valid }
11191230
; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
11201231
; TUNIT: attributes #[[ATTR10]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
11211232
; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
1122-
; TUNIT: attributes #[[ATTR12]] = { nofree nosync nounwind willreturn memory(read) }
1123-
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind willreturn }
1233+
; TUNIT: attributes #[[ATTR12]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
1234+
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind willreturn memory(read) }
1235+
; TUNIT: attributes #[[ATTR14]] = { nofree nosync nounwind willreturn }
11241236
;.
11251237
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
11261238
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind willreturn memory(none) uwtable }
@@ -1136,6 +1248,7 @@ attributes #2 = { null_pointer_is_valid }
11361248
; CGSCC: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
11371249
; CGSCC: attributes #[[ATTR12]] = { mustprogress nofree nosync nounwind willreturn memory(read) }
11381250
; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
1139-
; CGSCC: attributes #[[ATTR14]] = { nofree nosync willreturn }
1140-
; CGSCC: attributes #[[ATTR15]] = { nofree willreturn memory(read) }
1251+
; CGSCC: attributes #[[ATTR14]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
1252+
; CGSCC: attributes #[[ATTR15]] = { nofree nosync willreturn }
1253+
; CGSCC: attributes #[[ATTR16]] = { nofree willreturn memory(read) }
11411254
;.

llvm/test/Transforms/Attributor/nocapture-1.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,13 @@ define void @test6_2(ptr %x6_2, ptr %y6_2, ptr %z6_2) {
524524
define void @test_cmpxchg(ptr %p) {
525525
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
526526
; TUNIT-LABEL: define {{[^@]+}}@test_cmpxchg
527-
; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR8:[0-9]+]] {
527+
; TUNIT-SAME: (ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR8:[0-9]+]] {
528528
; TUNIT-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], i32 0, i32 1 acquire monotonic, align 4
529529
; TUNIT-NEXT: ret void
530530
;
531531
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
532532
; CGSCC-LABEL: define {{[^@]+}}@test_cmpxchg
533-
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR11:[0-9]+]] {
533+
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR11:[0-9]+]] {
534534
; CGSCC-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], i32 0, i32 1 acquire monotonic, align 4
535535
; CGSCC-NEXT: ret void
536536
;
@@ -541,13 +541,13 @@ define void @test_cmpxchg(ptr %p) {
541541
define void @test_cmpxchg_ptr(ptr %p, ptr %q) {
542542
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
543543
; TUNIT-LABEL: define {{[^@]+}}@test_cmpxchg_ptr
544-
; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR8]] {
544+
; TUNIT-SAME: (ptr nocapture nofree noundef nonnull align 8 dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR8]] {
545545
; TUNIT-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], ptr null, ptr [[Q]] acquire monotonic, align 8
546546
; TUNIT-NEXT: ret void
547547
;
548548
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
549549
; CGSCC-LABEL: define {{[^@]+}}@test_cmpxchg_ptr
550-
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR11]] {
550+
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull align 8 dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR11]] {
551551
; CGSCC-NEXT: [[TMP1:%.*]] = cmpxchg ptr [[P]], ptr null, ptr [[Q]] acquire monotonic, align 8
552552
; CGSCC-NEXT: ret void
553553
;
@@ -558,13 +558,13 @@ define void @test_cmpxchg_ptr(ptr %p, ptr %q) {
558558
define void @test_atomicrmw(ptr %p) {
559559
; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
560560
; TUNIT-LABEL: define {{[^@]+}}@test_atomicrmw
561-
; TUNIT-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR8]] {
561+
; TUNIT-SAME: (ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR8]] {
562562
; TUNIT-NEXT: [[TMP1:%.*]] = atomicrmw add ptr [[P]], i32 1 seq_cst, align 4
563563
; TUNIT-NEXT: ret void
564564
;
565565
; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
566566
; CGSCC-LABEL: define {{[^@]+}}@test_atomicrmw
567-
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[P:%.*]]) #[[ATTR11]] {
567+
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR11]] {
568568
; CGSCC-NEXT: [[TMP1:%.*]] = atomicrmw add ptr [[P]], i32 1 seq_cst, align 4
569569
; CGSCC-NEXT: ret void
570570
;

llvm/test/Transforms/Attributor/nofpclass.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ define double @fpext(float nofpclass(inf nan) %arg) {
18131813
define float @atomicrmw_fadd(ptr %ptr, float nofpclass(inf nan) %val) {
18141814
; CHECK: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)
18151815
; CHECK-LABEL: define float @atomicrmw_fadd
1816-
; CHECK-SAME: (ptr nocapture nofree noundef nonnull dereferenceable(4) [[PTR:%.*]], float nofpclass(nan inf) [[VAL:%.*]]) #[[ATTR6:[0-9]+]] {
1816+
; CHECK-SAME: (ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[PTR:%.*]], float nofpclass(nan inf) [[VAL:%.*]]) #[[ATTR6:[0-9]+]] {
18171817
; CHECK-NEXT: [[RESULT:%.*]] = atomicrmw fadd ptr [[PTR]], float [[VAL]] seq_cst, align 4
18181818
; CHECK-NEXT: ret float [[RESULT]]
18191819
;

0 commit comments

Comments
 (0)