[llvm] [IR] Relax convergence requirements on call (PR #135794)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 01:42:46 PDT 2025


================
@@ -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
+}
+
+
----------------
Keenuts wrote:

Right, also updated this one to use `--check-globals`

https://github.com/llvm/llvm-project/pull/135794


More information about the llvm-commits mailing list