[llvm] [UniformityAnalysis] Track uniform values for conservative divergence queries (PR #180509)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 03:34:42 PST 2026


================
@@ -1163,20 +1213,21 @@ void GenericUniformityAnalysisImpl<ContextT>::print(raw_ostream &OS) const {
   // Control flow instructions may be divergent even if their inputs are
   // uniform. Thus, although exceedingly rare, it is possible to have a program
   // with no divergent values but with divergent control structures.
-  if (DivergentValues.empty() && DivergentTermBlocks.empty() &&
+  if (!HasDivergence && DivergentTermBlocks.empty() &&
       DivergentExitCycles.empty()) {
     OS << "ALL VALUES UNIFORM\n";
     return;
   }
 
-  for (const auto &entry : DivergentValues) {
-    const BlockT *parent = Context.getDefBlock(entry);
-    if (!parent) {
-      if (!haveDivergentArgs) {
-        OS << "DIVERGENT ARGUMENTS:\n";
-        haveDivergentArgs = true;
+  if constexpr (!IsMIR) {
----------------
jmmartinez wrote:

Why only for LLVM-IR?

I find it odd that we only print the divergent arguments; but that is outside of this PR scope.

Is this function used? (I couldn't find uses of `print()`).

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


More information about the llvm-commits mailing list