[Mlir-commits] [mlir] [mlir][scf] Allow unrolling loops with integer-typed IV. (PR #106164)
Thomas Raoux
llvmlistbot at llvm.org
Mon Aug 26 17:49:02 PDT 2024
================
@@ -302,6 +302,16 @@ 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");
+ if (type.isIndex())
+ return b.create<arith::ConstantIndexOp>(loc, value);
+ else
+ return b.create<arith::ConstantOp>(loc, b.getIntegerAttr(type, value));
----------------
ThomasRaoux wrote:
What I meant is that I don't think you need the special case for `if (type.isIndex())`
https://github.com/llvm/llvm-project/pull/106164
More information about the Mlir-commits
mailing list