[llvm] 88ba7b6 - Attributor: Don't pretend memcpy is convergent in a test
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 15:03:28 PDT 2023
Author: Matt Arsenault
Date: 2023-07-11T18:03:20-04:00
New Revision: 88ba7b672403ff8c230d31f99b10fa012e02b485
URL: https://github.com/llvm/llvm-project/commit/88ba7b672403ff8c230d31f99b10fa012e02b485
DIFF: https://github.com/llvm/llvm-project/commit/88ba7b672403ff8c230d31f99b10fa012e02b485.diff
LOG: Attributor: Don't pretend memcpy is convergent in a test
The declared attributes for recognized intrinsics do not matter and
are ignored. Split this test into a normal memcpy which is never
convergent, and one that uses an unrecognized convergent intrinsic
declaration.
Added:
Modified:
llvm/test/Transforms/Attributor/convergent.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Attributor/convergent.ll b/llvm/test/Transforms/Attributor/convergent.ll
index 4b76de164402f4..1b686f83a6d9da 100644
--- a/llvm/test/Transforms/Attributor/convergent.ll
+++ b/llvm/test/Transforms/Attributor/convergent.ll
@@ -20,7 +20,7 @@ define i32 @calls_defined() convergent {
; CGSCC: Function Attrs: convergent mustprogress nofree nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@calls_defined
; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {
-; CGSCC-NEXT: [[A:%.*]] = call noundef i32 @defined() #[[ATTR5:[0-9]+]]
+; CGSCC-NEXT: [[A:%.*]] = call noundef i32 @defined() #[[ATTR6:[0-9]+]]
; CGSCC-NEXT: ret i32 [[A]]
;
%a = call i32 @defined()
@@ -88,35 +88,59 @@ define i32 @calls_defined_with_asm(i32 %a, i32 %b) convergent {
ret i32 %c
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(ptr %dest, ptr %src, i64 %size, i1 %isVolatile) convergent
+declare void @llvm.convergent.copy.p0i8.p0i8.i64(ptr %dest, ptr %src, i64 %size, i1 %isVolatile) #0
+
+define void @calls_convergent_intrinsic(ptr %dest, ptr %src, i64 %size) convergent {
+; TUNIT: Function Attrs: convergent mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)
+; TUNIT-LABEL: define {{[^@]+}}@calls_convergent_intrinsic
+; TUNIT-SAME: (ptr nofree [[DEST:%.*]], ptr nofree [[SRC:%.*]], i64 [[SIZE:%.*]]) #[[ATTR3:[0-9]+]] {
+; TUNIT-NEXT: call void @llvm.convergent.copy.p0i8.p0i8.i64(ptr nofree [[DEST]], ptr nofree [[SRC]], i64 [[SIZE]], i1 noundef false) #[[ATTR5:[0-9]+]]
+; TUNIT-NEXT: ret void
+;
+; CGSCC: Function Attrs: convergent mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)
+; CGSCC-LABEL: define {{[^@]+}}@calls_convergent_intrinsic
+; CGSCC-SAME: (ptr nofree [[DEST:%.*]], ptr nofree [[SRC:%.*]], i64 [[SIZE:%.*]]) #[[ATTR4:[0-9]+]] {
+; CGSCC-NEXT: call void @llvm.convergent.copy.p0i8.p0i8.i64(ptr nofree [[DEST]], ptr nofree [[SRC]], i64 [[SIZE]], i1 noundef false) #[[ATTR6]]
+; CGSCC-NEXT: ret void
+;
+ call void @llvm.convergent.copy.p0i8.p0i8.i64(ptr %dest, ptr %src, i64 %size, i1 false)
+ ret void
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(ptr %dest, ptr %src, i64 %size, i1 %isVolatile) #0
define void @calls_intrinsic(ptr %dest, ptr %src, i64 %size) convergent {
; TUNIT: Function Attrs: convergent mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@calls_intrinsic
; TUNIT-SAME: (ptr nocapture nofree writeonly [[DEST:%.*]], ptr nocapture nofree readonly [[SRC:%.*]], i64 [[SIZE:%.*]]) #[[ATTR2:[0-9]+]] {
-; TUNIT-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr nocapture nofree writeonly [[DEST]], ptr nocapture nofree readonly [[SRC]], i64 [[SIZE]], i1 noundef false) #[[ATTR4:[0-9]+]]
+; TUNIT-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr nocapture nofree writeonly [[DEST]], ptr nocapture nofree readonly [[SRC]], i64 [[SIZE]], i1 noundef false) #[[ATTR5]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: convergent mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@calls_intrinsic
; CGSCC-SAME: (ptr nocapture nofree writeonly [[DEST:%.*]], ptr nocapture nofree readonly [[SRC:%.*]], i64 [[SIZE:%.*]]) #[[ATTR3:[0-9]+]] {
-; CGSCC-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr nocapture nofree writeonly [[DEST]], ptr nocapture nofree readonly [[SRC]], i64 [[SIZE]], i1 noundef false) #[[ATTR5]]
+; CGSCC-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr nocapture nofree writeonly [[DEST]], ptr nocapture nofree readonly [[SRC]], i64 [[SIZE]], i1 noundef false) #[[ATTR6]]
; CGSCC-NEXT: ret void
;
call void @llvm.memcpy.p0i8.p0i8.i64(ptr %dest, ptr %src, i64 %size, i1 false)
ret void
}
+
+attributes #0 = { convergent mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
+
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { convergent }
; TUNIT: attributes #[[ATTR2]] = { convergent mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
-; TUNIT: attributes #[[ATTR4]] = { nofree willreturn }
+; TUNIT: attributes #[[ATTR3]] = { convergent mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) }
+; TUNIT: attributes #[[ATTR4:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
+; TUNIT: attributes #[[ATTR5]] = { nofree willreturn }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { convergent mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { convergent }
; CGSCC: attributes #[[ATTR3]] = { convergent mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR4:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
-; CGSCC: attributes #[[ATTR5]] = { nofree willreturn }
+; CGSCC: attributes #[[ATTR4]] = { convergent mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) }
+; CGSCC: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
+; CGSCC: attributes #[[ATTR6]] = { nofree willreturn }
;.
More information about the llvm-commits
mailing list