[clang] [CIR][AMDGPU] Add module flags for AMDGPU target using amendOperation of CIRDialectLLVMIRTranslationInterface (PR #186073)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 22:55:10 PDT 2026


================
@@ -47,6 +47,63 @@ class CIRDialectLLVMIRTranslationInterface
 
     return mlir::success();
   }
+
+  /// Any named attribute in the CIR dialect, i.e, with name started with
+  /// "cir.", will be handled here.
+  virtual mlir::LogicalResult amendOperation(
+      mlir::Operation *op, llvm::ArrayRef<llvm::Instruction *> instructions,
+      mlir::NamedAttribute attribute,
+      mlir::LLVM::ModuleTranslation &moduleTranslation) const override {
+    if (auto func = dyn_cast<mlir::LLVM::LLVMFuncOp>(op)) {
+      if (mlir::failed(
+              amendFunction(func, instructions, attribute, moduleTranslation)))
----------------
skc7 wrote:

@andykaylor 
My follow-up PR is actually to add support for `extra_attrs`, draft PR: https://github.com/llvm/llvm-project/pull/186331 

My understanding is targets add their attributes to `extra_attrs` on cir.func as in incubator
Could you please let me know if that is still needed in upstream ?

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


More information about the cfe-commits mailing list