[clang] [CIR] [Upstream local initialization for ArrayType (PR #132974)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 15:52:37 PDT 2025
================
@@ -32,6 +32,16 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
return create<cir::ConstantOp>(loc, attr.getType(), attr);
}
+ cir::ConstantOp getConstantInt(mlir::Location loc, mlir::Type ty,
+ int64_t value) {
+ return create<cir::ConstantOp>(loc, ty, cir::IntAttr::get(ty, value));
+ }
+
+ // Creates constant null value for integral type ty.
+ cir::ConstantOp getNullValue(mlir::Type ty, mlir::Location loc) {
+ return create<cir::ConstantOp>(loc, ty, getZeroInitAttr(ty));
----------------
bcardosolopes wrote:
Both `getConstantInt` and `getNullValue` should be implemented in terms of the `getConstant` above, and diminish the amount of direct calls to `create`.
https://github.com/llvm/llvm-project/pull/132974
More information about the cfe-commits
mailing list