[llvm] [UniformityAnalysis] Skip CycleAnalysis on targets without branch divergence (PR #189948)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 02:08:54 PDT 2026


================
@@ -1289,29 +1289,35 @@ GenericUniformityInfo<ContextT>::getFunction() const {
 }
 
 /// Whether \p V is divergent at its definition.
+/// A default-constructed instance (no analysis computed) reports everything
+/// as uniform, which is conservatively correct for non-divergent targets.
 template <typename ContextT>
 bool GenericUniformityInfo<ContextT>::isDivergent(ConstValueRefT V) const {
-  return DA->isDivergent(V);
+  return DA && DA->isDivergent(V);
----------------
ssahasra wrote:

Yeah, "is it optional" is the wrong lens to look at this. If the target does not support divergence, then UA is _trivial_, and this patch returns quickly by not creating the internal DA object.

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


More information about the llvm-commits mailing list