[Mlir-commits] [clang] [mlir] [CIR] Implement returns_twice, cold, hot, noduplicate, convergent fun… (PR #178289)

Erich Keane llvmlistbot at llvm.org
Tue Jan 27 14:53:43 PST 2026


================
@@ -1670,6 +1670,14 @@ static void convertFunctionAttributes(LLVMFuncOp func,
     llvmFunc->addFnAttr(llvm::Attribute::InlineHint);
   if (func.getOptimizeNoneAttr())
     llvmFunc->addFnAttr(llvm::Attribute::OptimizeNone);
+  if (func.getReturnsTwiceAttr())
----------------
erichkeane wrote:

LLVM-MLIR folks:

This here is what causes us to have to add a new 'attribute' to the Ops every time we add one.  We don't have any way of doing a "just pass through all the rest" as far as I can tell.  

I have no problem continuing to add the attributes this way (at which point I MIGHT suggest some sort of diagnostic when we have an attribute that ISN'T on this list?), but I was wondering if you still have appetite to keep adding them this way?

The `LowerToLLVM.cpp` in clang does something similar, except at the end of `lowerCallAttributes` (and a similar `lowerFunctionAttributes`), we do a 'copy everything that isn't disallowed in an 'if').

Just let me know if you'd prefer to continue adding an attribute-for-each, or if there is apassthru mechanism I could use/you could suggest/tell me how to implement/etc.

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


More information about the Mlir-commits mailing list