[Mlir-commits] [clang] [mlir] [OpenACC] Implement tile/collapse lowering (PR #138576)

Bruno Cardoso Lopes llvmlistbot at llvm.org
Tue May 6 10:10:45 PDT 2025


================
@@ -82,6 +83,17 @@ class OpenACCClauseCIREmitter final
     return conversionOp.getResult(0);
   }
 
+  mlir::Value createConstantInt(mlir::Location loc, unsigned width,
+                                int64_t value) {
+    mlir::IntegerType ty = mlir::IntegerType::get(
+        &cgf.getMLIRContext(), width,
+        mlir::IntegerType::SignednessSemantics::Signless);
+    auto constOp = builder.create<mlir::arith::ConstantOp>(
+        loc, ty, builder.getIntegerAttr(ty, value));
----------------
bcardosolopes wrote:

The way to get the generic canonicalizer pass to fold constants is to implement `::fold` methods (and declare ops with `hasFolder = 1`) and then run the canonicalizer pass. Alternatively you can add the op to CIRCanonicalizer as well, which will call into the same apply greedy rewrite stuff.

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


More information about the Mlir-commits mailing list