Skip to content

Commit 90dd12d

Browse files
Apply reviews
1 parent 336ceff commit 90dd12d

File tree

3 files changed

+18
-31
lines changed

3 files changed

+18
-31
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,10 +1437,10 @@ def CIR_BrCondOp : CIR_Op<"brcond", [
14371437
// IndirectBrOp
14381438
//===----------------------------------------------------------------------===//
14391439

1440-
def CIR_IndirectBrOp : CIR_Op<"indirectbr", [
1440+
def CIR_IndirectBrOp : CIR_Op<"indirect_br", [
14411441
DeclareOpInterfaceMethods<BranchOpInterface>,
1442-
SameVariadicOperandSize, Terminator, Pure]
1443-
> {
1442+
SameVariadicOperandSize, Terminator, Pure
1443+
]> {
14441444
let summary = "Indirect branch";
14451445
let description = [{
14461446
The `cir.indirectbr` operation represents an indirect branch to one of
@@ -1457,40 +1457,27 @@ def CIR_IndirectBrOp : CIR_Op<"indirectbr", [
14571457
Example:
14581458

14591459
```mlir
1460-
%0 = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["ptr", init]
1461-
%1 = cir.block_address <@A, "A"> : !cir.ptr<!void>
1462-
cir.store align(8) %1, %0 : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>
1463-
%2 = cir.load align(8) %0 : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
1464-
cir.br ^bb1(%2 : !cir.ptr<!void>)
1465-
^bb1(%3: !cir.ptr<!void>):
1466-
cir.indirectbr %3 : <!void>, [
1467-
^bb2
1468-
]
1469-
```
1470-
or with a poison:
1471-
1472-
```mlir
1460+
%0 = cir.block_address <@A, "A"> : !cir.ptr<!void>
14731461
cir.indirectbr %0 poison : <!void>, [
1474-
^bb3,
1475-
^bb2
1462+
^bb1
14761463
]
14771464
```
14781465
}];
14791466

14801467
let arguments = (ins
14811468
CIR_VoidPtrType:$addr,
14821469
UnitAttr:$poison,
1483-
VariadicOfVariadic<AnyType, "indbr_operand_segments">:$succOperands,
1484-
DenseI32ArrayAttr:$indbr_operand_segments
1470+
VariadicOfVariadic<AnyType, "operand_segments">:$succ_operands,
1471+
DenseI32ArrayAttr:$operand_segments
14851472
);
14861473

14871474
let successors = (successor VariadicSuccessor<AnySuccessor>:$successors);
14881475
let assemblyFormat = [{
1489-
$addr ( `poison` $poison^ )? `:` type($addr) `,`
1476+
$addr ( `poison` $poison^ )? `:` qualified(type($addr)) `,`
14901477
custom<IndirectBrOpSucessors>(ref(type($addr)),
14911478
$successors,
1492-
$succOperands,
1493-
type($succOperands))
1479+
$succ_operands,
1480+
type($succ_operands))
14941481
attr-dict
14951482
}];
14961483
}

clang/test/CIR/CodeGen/label-values.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void A(void) {
1717
// CIR: [[BLOCKADD:%.*]] = cir.load align(8) [[PTR]] : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
1818
// CIR: cir.br ^bb1([[BLOCKADD]] : !cir.ptr<!void>)
1919
// CIR: ^bb1([[PHI:%.*]]: !cir.ptr<!void> {{.*}}): // pred: ^bb0
20-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
20+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
2121
// CIR: ^bb2
2222
// CIR: ]
2323
// CIR: ^bb2: // pred: ^bb1
@@ -51,7 +51,7 @@ void B(void) {
5151
// CIR: [[BLOCKADD:%.*]] = cir.load align(8) [[PTR]] : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
5252
// CIR: cir.br ^bb2([[BLOCKADD]] : !cir.ptr<!void>)
5353
// CIR: ^bb2([[PHI:%.*]]: !cir.ptr<!void> {{.*}}): // pred: ^bb1
54-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
54+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
5555
// CIR-NEXT: ^bb1
5656
// CIR: ]
5757

@@ -83,7 +83,7 @@ void C(int x) {
8383
// CIR: [[BLOCKADD:%.*]] = cir.load align(8) [[PTR]] : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
8484
// CIR: cir.br ^bb1([[BLOCKADD]] : !cir.ptr<!void>)
8585
// CIR: ^bb1([[PHI:%.*]]: !cir.ptr<!void> {{.*}}): // pred: ^bb0
86-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
86+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
8787
// CIR-NEXT: ^bb2,
8888
// CIR-NEXT: ^bb4
8989
// CIR: ]
@@ -130,7 +130,7 @@ void D(void) {
130130
// CIR: cir.store align(8) %[[BLK2]], %[[PTR2]] : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>
131131
// CIR: cir.br ^bb1
132132
// CIR: ^bb1([[PHI:%*.]]: !cir.ptr<!void> {{.*}}): // pred: ^bb0
133-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
133+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
134134
// CIR-DAG: ^bb2,
135135
// CIR-DAG: ^bb2,
136136
// CIR-DAG: ^bb2
@@ -170,9 +170,9 @@ void E(void) {
170170
return;
171171
}
172172

173-
//CIR: cir.func dso_local @E()
173+
//CIR: cir.func {{.*}} @E()
174174
//CIR: ^bb1({{.*}}: !cir.ptr<!void> {{.*}}): // no predecessors
175-
//CIR: cir.indirectbr {{.*}} poison : <!void>, [
175+
//CIR: cir.indirect_br {{.*}} poison : !cir.ptr<!void>, [
176176
//CIR-NEXT: ^bb5,
177177
//CIR-NEXT: ^bb4,
178178
//CIR-NEXT: ^bb3,

clang/test/CIR/IR/indirect-br.cir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cir.func @E() {
1414
%6 = cir.load align(8) %0 : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
1515
cir.br ^bb1(%6 : !cir.ptr<!void>)
1616
^bb1(%7: !cir.ptr<!void>): // pred: ^bb0
17-
cir.indirectbr %7 : <!void>, [
17+
cir.indirect_br %7 : !cir.ptr<!void>, [
1818
^bb5,
1919
^bb4,
2020
^bb3,
@@ -38,7 +38,7 @@ cir.func @E() {
3838
cir.return
3939
}
4040

41-
// CHECK: cir.indirectbr %7 : <!void>, [
41+
// CHECK: cir.indirect_br %7 : !cir.ptr<!void>, [
4242
// CHECK: ^bb5,
4343
// CHECK: ^bb4,
4444
// CHECK: ^bb3,

0 commit comments

Comments
 (0)