[llvm] [Uniformity] Avoid marking all PHIs as divergent in join blocks (PR #157808)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 03:15:01 PDT 2025


================
@@ -172,9 +172,9 @@ X:
 ; CHECK: DIVERGENT: %div.merge.x =
 
 Y:
-  %div.merge.y = phi i32 [ 42, %X ], [ %b, %B ]
+  %merge.y = phi i32 [ 42, %X ], [ %b, %B ]
   ret void
-; CHECK: DIVERGENT: %div.merge.y =
+; CHECK-NOT: DIVERGENT: %merge.y =
----------------
jayfoad wrote:

I _think_ this change is wrong. Once we go entry->H->G, there is a divergent branch which can choose either G->X->Y or G->L->C->H->B->Y (!). Therefore the choice of whether we arrive at Y from X or from B is divergent.

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


More information about the llvm-commits mailing list