@@ -57,6 +57,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
5757public:
5858 CIRBaseBuilderTy (mlir::MLIRContext &mlirContext)
5959 : mlir::OpBuilder(&mlirContext) {}
60+ CIRBaseBuilderTy (mlir::OpBuilder &builder) : mlir::OpBuilder(builder) {}
6061
6162 mlir::Value getConstAPInt (mlir::Location loc, mlir::Type typ,
6263 const llvm::APInt &val) {
@@ -98,13 +99,13 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
9899 if (auto recordTy = mlir::dyn_cast<cir::RecordType>(ty))
99100 return getZeroAttr (recordTy);
100101 if (mlir::isa<cir::BoolType>(ty)) {
101- return getCIRBoolAttr ( false );
102+ return getFalseAttr ( );
102103 }
103104 llvm_unreachable (" Zero initializer for given type is NYI" );
104105 }
105106
106107 cir::ConstantOp getBool (bool state, mlir::Location loc) {
107- return create<cir::ConstantOp>(loc, getBoolTy (), getCIRBoolAttr (state));
108+ return create<cir::ConstantOp>(loc, getCIRBoolAttr (state));
108109 }
109110 cir::ConstantOp getFalse (mlir::Location loc) { return getBool (false , loc); }
110111 cir::ConstantOp getTrue (mlir::Location loc) { return getBool (true , loc); }
@@ -120,9 +121,12 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
120121 }
121122
122123 cir::BoolAttr getCIRBoolAttr (bool state) {
123- return cir::BoolAttr::get (getContext (), getBoolTy (), state);
124+ return cir::BoolAttr::get (getContext (), state);
124125 }
125126
127+ cir::BoolAttr getTrueAttr () { return getCIRBoolAttr (true ); }
128+ cir::BoolAttr getFalseAttr () { return getCIRBoolAttr (false ); }
129+
126130 mlir::Value createNot (mlir::Value value) {
127131 return create<cir::UnaryOp>(value.getLoc (), value.getType (),
128132 cir::UnaryOpKind::Not, value);
0 commit comments