File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,9 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy {
250
250
if (const auto intVal = attr.dyn_cast <mlir::cir::IntAttr>())
251
251
return intVal.isNullValue ();
252
252
253
+ if (const auto boolVal = attr.dyn_cast <mlir::cir::BoolAttr>())
254
+ return !boolVal.getValue ();
255
+
253
256
if (const auto fpVal = attr.dyn_cast <mlir::FloatAttr>()) {
254
257
bool ignored;
255
258
llvm::APFloat FV (+0.0 );
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ typedef struct {
7
7
bool x ;
8
8
} S ;
9
9
10
+ // CHECK: cir.func @init_bool
11
+ // CHECK: [[ALLOC:%.*]] = cir.alloca !ty_22S22, cir.ptr <!ty_22S22>
12
+ // CHECK: [[ZERO:%.*]] = cir.const(#cir.zero : !ty_22S22) : !ty_22S22
13
+ // CHECK: cir.store [[ZERO]], [[ALLOC]] : !ty_22S22, cir.ptr <!ty_22S22>
14
+ void init_bool (void ) {
15
+ S s = {0 };
16
+ }
17
+
10
18
// CHECK: cir.func @store_bool
11
19
// CHECK: [[TMP0:%.*]] = cir.alloca !cir.ptr<!ty_22S22>, cir.ptr <!cir.ptr<!ty_22S22>>
12
20
// CHECK: cir.store %arg0, [[TMP0]] : !cir.ptr<!ty_22S22>, cir.ptr <!cir.ptr<!ty_22S22>>
@@ -28,4 +36,4 @@ void store_bool(S *s) {
28
36
// CHECK: [[TMP4:%.*]] = cir.load [[TMP3]] : cir.ptr <!cir.bool>, !cir.bool
29
37
void load_bool (S * s ) {
30
38
bool x = s -> x ;
31
- }
39
+ }
You can’t perform that action at this time.
0 commit comments