Skip to content

Commit abe7c76

Browse files
Apply reviews
1 parent 16f6eea commit abe7c76

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
@@ -1466,10 +1466,10 @@ def CIR_BrCondOp : CIR_Op<"brcond", [
14661466
// IndirectBrOp
14671467
//===----------------------------------------------------------------------===//
14681468

1469-
def CIR_IndirectBrOp : CIR_Op<"indirectbr", [
1469+
def CIR_IndirectBrOp : CIR_Op<"indirect_br", [
14701470
DeclareOpInterfaceMethods<BranchOpInterface>,
1471-
SameVariadicOperandSize, Terminator, Pure]
1472-
> {
1471+
SameVariadicOperandSize, Terminator, Pure
1472+
]> {
14731473
let summary = "Indirect branch";
14741474
let description = [{
14751475
The `cir.indirectbr` operation represents an indirect branch to one of
@@ -1486,40 +1486,27 @@ def CIR_IndirectBrOp : CIR_Op<"indirectbr", [
14861486
Example:
14871487

14881488
```mlir
1489-
%0 = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["ptr", init]
1490-
%1 = cir.block_address <@A, "A"> : !cir.ptr<!void>
1491-
cir.store align(8) %1, %0 : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>
1492-
%2 = cir.load align(8) %0 : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
1493-
cir.br ^bb1(%2 : !cir.ptr<!void>)
1494-
^bb1(%3: !cir.ptr<!void>):
1495-
cir.indirectbr %3 : <!void>, [
1496-
^bb2
1497-
]
1498-
```
1499-
or with a poison:
1500-
1501-
```mlir
1489+
%0 = cir.block_address <@A, "A"> : !cir.ptr<!void>
15021490
cir.indirectbr %0 poison : <!void>, [
1503-
^bb3,
1504-
^bb2
1491+
^bb1
15051492
]
15061493
```
15071494
}];
15081495

15091496
let arguments = (ins
15101497
CIR_VoidPtrType:$addr,
15111498
UnitAttr:$poison,
1512-
VariadicOfVariadic<AnyType, "indbr_operand_segments">:$succOperands,
1513-
DenseI32ArrayAttr:$indbr_operand_segments
1499+
VariadicOfVariadic<AnyType, "operand_segments">:$succ_operands,
1500+
DenseI32ArrayAttr:$operand_segments
15141501
);
15151502

15161503
let successors = (successor VariadicSuccessor<AnySuccessor>:$successors);
15171504
let assemblyFormat = [{
1518-
$addr ( `poison` $poison^ )? `:` type($addr) `,`
1505+
$addr ( `poison` $poison^ )? `:` qualified(type($addr)) `,`
15191506
custom<IndirectBrOpSucessors>(ref(type($addr)),
15201507
$successors,
1521-
$succOperands,
1522-
type($succOperands))
1508+
$succ_operands,
1509+
type($succ_operands))
15231510
attr-dict
15241511
}];
15251512
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void A(void) {
1616
// CIR: [[BLOCKADD:%.*]] = cir.load align(8) [[PTR]] : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
1717
// CIR: cir.br ^bb1([[BLOCKADD]] : !cir.ptr<!void>)
1818
// CIR: ^bb1([[PHI:%.*]]: !cir.ptr<!void> {{.*}}): // pred: ^bb0
19-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
19+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
2020
// CIR: ^bb2
2121
// CIR: ]
2222
// CIR: ^bb2: // pred: ^bb1
@@ -50,7 +50,7 @@ void B(void) {
5050
// CIR: [[BLOCKADD:%.*]] = cir.load align(8) [[PTR]] : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
5151
// CIR: cir.br ^bb2([[BLOCKADD]] : !cir.ptr<!void>)
5252
// CIR: ^bb2([[PHI:%.*]]: !cir.ptr<!void> {{.*}}): // pred: ^bb1
53-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
53+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
5454
// CIR-NEXT: ^bb1
5555
// CIR: ]
5656

@@ -82,7 +82,7 @@ void C(int x) {
8282
// CIR: [[BLOCKADD:%.*]] = cir.load align(8) [[PTR]] : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
8383
// CIR: cir.br ^bb1([[BLOCKADD]] : !cir.ptr<!void>)
8484
// CIR: ^bb1([[PHI:%.*]]: !cir.ptr<!void> {{.*}}): // pred: ^bb0
85-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
85+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
8686
// CIR-NEXT: ^bb2,
8787
// CIR-NEXT: ^bb4
8888
// CIR: ]
@@ -129,7 +129,7 @@ void D(void) {
129129
// CIR: cir.store align(8) %[[BLK2]], %[[PTR2]] : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>
130130
// CIR: cir.br ^bb1
131131
// CIR: ^bb1([[PHI:%*.]]: !cir.ptr<!void> {{.*}}): // pred: ^bb0
132-
// CIR: cir.indirectbr [[PHI]] : <!void>, [
132+
// CIR: cir.indirect_br [[PHI]] : !cir.ptr<!void>, [
133133
// CIR-DAG: ^bb2,
134134
// CIR-DAG: ^bb2,
135135
// CIR-DAG: ^bb2
@@ -169,9 +169,9 @@ void E(void) {
169169
return;
170170
}
171171

172-
//CIR: cir.func dso_local @E()
172+
//CIR: cir.func {{.*}} @E()
173173
//CIR: ^bb1({{.*}}: !cir.ptr<!void> {{.*}}): // no predecessors
174-
//CIR: cir.indirectbr {{.*}} poison : <!void>, [
174+
//CIR: cir.indirect_br {{.*}} poison : !cir.ptr<!void>, [
175175
//CIR-NEXT: ^bb5,
176176
//CIR-NEXT: ^bb4,
177177
//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)