[llvm] [IR] Relax convergence requirements on call (PR #135794)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 08:21:46 PDT 2025
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/135794 at github.com>
================
@@ -129,3 +129,32 @@ define i32 @noopt_friend() convergent {
%a = call i32 @noopt()
ret i32 0
}
+
+
+; A function which is stripped of its convergent attribute, even
+; if used in a controlled convergence call.
+; This should be OK.
+define i32 @leaf_noconvergent_used() convergent {
+; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; CHECK-LABEL: define {{[^@]+}}@leaf_noconvergent_used
+; CHECK-SAME: () #[[ATTR0]] {
+; CHECK-NEXT: ret i32 0
+;
+ ret i32 0
+}
+
+define i32 @nonleaf_convergent() convergent {
+; CHECK: Function Attrs: convergent mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; CHECK-LABEL: define {{[^@]+}}@nonleaf_convergent
+; CHECK-SAME: () #[[ATTR7:[0-9]+]] {
+; CHECK-NEXT: [[TMP1:%.*]] = call token @llvm.experimental.convergence.entry()
+; CHECK-NEXT: [[TMP2:%.*]] = call i32 @leaf_noconvergent_used() [ "convergencectrl"(token [[TMP1]]) ]
+; CHECK-NEXT: ret i32 0
+;
+ %1 = call token @llvm.experimental.convergence.entry()
+ %2 = call i32 @leaf_noconvergent_used() [ "convergencectrl"(token %1) ]
+ ret i32 0
+}
+
+
----------------
arsenm wrote:
This one is missing the actual attribute checks
https://github.com/llvm/llvm-project/pull/135794
More information about the llvm-commits
mailing list