[llvm] [UniformityAnalysis] Replace DivergentValues with UniformValues for conservative divergence queries (PR #180509)

Pankaj Dwivedi via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 05:49:38 PDT 2026


================
@@ -73,6 +49,58 @@ void llvm::GenericUniformityAnalysisImpl<SSAContext>::pushUsers(
   pushUsers(cast<Value>(&Instr));
 }
 
+template <>
+bool llvm::GenericUniformityAnalysisImpl<SSAContext>::printDivergentArgs(
+    raw_ostream &OS) const {
+  bool haveDivergentArgs = false;
+  for (const auto &Arg : F.args()) {
+    if (isDivergent(&Arg)) {
+      if (!haveDivergentArgs) {
+        OS << "DIVERGENT ARGUMENTS:\n";
+        haveDivergentArgs = true;
+      }
+      OS << "  DIVERGENT: " << Context.print(&Arg) << '\n';
+    }
+  }
+  return haveDivergentArgs;
+}
+
+template <> void llvm::GenericUniformityAnalysisImpl<SSAContext>::initialize() {
+  // Pre-populate UniformValues with all values, then seed divergence.
+  // Values are removed from UniformValues as divergence is propagated.
+  SmallVector<const Value *, 4> DivergentArgs;
+  for (auto &Arg : F.args()) {
+    UniformValues.insert(&Arg);
----------------
PankajDwivedi-25 wrote:

Right, fixed in latest patch.

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


More information about the llvm-commits mailing list