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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 04:41:35 PDT 2026


================
@@ -216,18 +215,20 @@ void UniformityInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
 }
 
 bool UniformityInfoWrapperPass::runOnFunction(Function &F) {
-  auto &cycleInfo = getAnalysis<CycleInfoWrapperPass>().getResult();
-  auto &domTree = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
   auto &targetTransformInfo =
       getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
 
   m_function = &F;
-  m_uniformityInfo = UniformityInfo{domTree, cycleInfo, &targetTransformInfo};
 
-  // Skip computation if we can assume everything is uniform.
-  if (targetTransformInfo.hasBranchDivergence(m_function))
-    m_uniformityInfo.compute();
+  if (!targetTransformInfo.hasBranchDivergence(m_function)) {
+    m_uniformityInfo = UniformityInfo{};
+    return false;
+  }
 
+  auto &cycleInfo = getAnalysis<CycleInfoWrapperPass>().getResult();
----------------
jayfoad wrote:

I'd prefer that done separately. Also removing the `m_` prefix from member variables, which is not a thing in LLVM.

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


More information about the llvm-commits mailing list