[clang] [clang][CUDA] Add 'noconvergent' function and statement attribute (PR #100637)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 09:42:44 PDT 2024


================
@@ -5636,9 +5639,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
     Attrs =
         Attrs.addFnAttribute(getLLVMContext(), llvm::Attribute::AlwaysInline);
 
-  // Add call-site convergent attribute if exists.
-  if (InConvergentAttributedStmt)
-    Attrs = Attrs.addFnAttribute(getLLVMContext(), llvm::Attribute::Convergent);
+  // Remove call-site convergent attribute if requested.
+  if (InNoConvergentAttributedStmt)
+    Attrs =
+        Attrs.removeFnAttribute(getLLVMContext(), llvm::Attribute::Convergent);
----------------
darkbuck wrote:

> Is it easy to avoid adding this in the first place?

`getTrivialDefaultFunctionAttributes` needs an extra argument to avoid that. However, that helper is called in several places, and that extra info is not always available. Forcing a default value in those places seems unreasonable or incorrect.

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


More information about the cfe-commits mailing list