[Mlir-commits] [mlir] [mlir][scf] Allow unrolling loops with integer-typed IV. (PR #106164)

Mehdi Amini llvmlistbot at llvm.org
Mon Aug 26 18:16:10 PDT 2024


================
@@ -302,6 +302,13 @@ Value mlir::createScalarOrSplatConstant(OpBuilder &builder, Location loc,
   return builder.createOrFold<arith::ConstantOp>(loc, type, splat);
 }
 
+Value mlir::createIntOrIndexConstant(OpBuilder &b, Location loc, Type type,
+                                     int64_t value) {
+  assert(type.isIntOrIndex() &&
+         "unexpected type other than integers and index");
+  return b.create<arith::ConstantOp>(loc, b.getIntegerAttr(type, value));
+}
----------------
joker-eph wrote:

Seems like this wrapper does not add any value: can we just inline this at use sites?

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


More information about the Mlir-commits mailing list