[llvm] [LLVM] New NoDivergenceSource function attribute (PR #111832)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 07:00:30 PDT 2024


================
@@ -32,7 +32,14 @@ bool llvm::GenericUniformityAnalysisImpl<SSAContext>::markDefsDivergent(
 
 template <> void llvm::GenericUniformityAnalysisImpl<SSAContext>::initialize() {
   for (auto &I : instructions(F)) {
-    if (TTI->isSourceOfDivergence(&I))
+    bool NoDivergenceSource = false;
+    if (auto Call = dyn_cast<CallInst>(&I)) {
+      if (Function *Callee = Call->getCalledFunction()) {
+        if (Callee->hasFnAttribute(Attribute::NoDivergenceSource))
----------------
jayfoad wrote:

Great. Then I think this patch should check attributes on the call. It seems reasonable that a call could be "no divergence source" either with an unknown callee (e.g. an indirect call) or because the frontend knows something about that specific call site even though the callee could in general introduce divergence.

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


More information about the llvm-commits mailing list