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

Hongtao Yu llvmlistbot at llvm.org
Mon Aug 26 21:02:57 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));
+}
----------------
htyu wrote:

Sounds good.

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


More information about the Mlir-commits mailing list