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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 06:13:19 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:

I think it might make more sense to check the attributes on the call instruction instead of the callee function, but I have never quite understood the interaction between the two -- e.g. is there something generic that propagates attributes from the callee to the call? Or are you supposed to check both the call and the callee (if known)?

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


More information about the llvm-commits mailing list