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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 06:14:45 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))
----------------
nikic wrote:

Checking attributes on the call will automatically check them on both the call itself and the callee, if it is known.

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


More information about the llvm-commits mailing list