| 1 |
// RUN: cir-opt %s --verify-roundtrip | FileCheck %s |
| 2 |
|
| 3 |
!void = !cir.void |
| 4 |
|
| 5 |
cir.func @E() { |
| 6 |
%0 = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["ptr", init] {alignment = 8 : i64} |
| 7 |
%1 = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["ptr2", init] {alignment = 8 : i64} |
| 8 |
%2 = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["ptr3", init] {alignment = 8 : i64} |
| 9 |
%3 = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["ptr4", init] {alignment = 8 : i64} |
| 10 |
%4 = cir.block_address <@E, "D"> : !cir.ptr<!void> |
| 11 |
cir.store align(8) %4, %0 : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>> |
| 12 |
%5 = cir.block_address <@E, "C"> : !cir.ptr<!void> |
| 13 |
cir.store align(8) %5, %1 : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>> |
| 14 |
%6 = cir.load align(8) %0 : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void> |
| 15 |
cir.br ^bb1(%6 : !cir.ptr<!void>) |
| 16 |
^bb1(%7: !cir.ptr<!void>): // pred: ^bb0 |
| 17 |
cir.indirect_br %7 : !cir.ptr<!void>, [ |
| 18 |
^bb5, |
| 19 |
^bb4, |
| 20 |
^bb3, |
| 21 |
^bb2 |
| 22 |
] |
| 23 |
^bb2: // pred: ^bb1 |
| 24 |
cir.label "A" |
| 25 |
cir.br ^bb3 |
| 26 |
^bb3: // 2 preds: ^bb1, ^bb2 |
| 27 |
cir.label "B" |
| 28 |
%8 = cir.block_address <@E, "B"> : !cir.ptr<!void> |
| 29 |
cir.store align(8) %8, %2 : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>> |
| 30 |
%9 = cir.block_address <@E, "A"> : !cir.ptr<!void> |
| 31 |
cir.store align(8) %9, %3 : !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>> |
| 32 |
cir.br ^bb4 |
| 33 |
^bb4: // 2 preds: ^bb1, ^bb3 |
| 34 |
cir.label "C" |
| 35 |
cir.br ^bb5 |
| 36 |
^bb5: // 2 preds: ^bb1, ^bb4 |
| 37 |
cir.label "D" |
| 38 |
cir.return |
| 39 |
} |
| 40 |
|
| 41 |
// CHECK: cir.indirect_br %7 : !cir.ptr<!void>, [ |
| 42 |
// CHECK: ^bb5, |
| 43 |
// CHECK: ^bb4, |
| 44 |
// CHECK: ^bb3, |
| 45 |
// CHECK: ^bb2 |
| 46 |
// CHECK: ] |