-
Notifications
You must be signed in to change notification settings - Fork 168
Closed
Description
Reproducer:
void action1();
void action2();
void double_label(int v) {
switch (v) {
default:
action1();
label:
action2();
break;
}
}
Diagnostic message:
loc("/disk2/workspace.xuchuanqi/clangir/clang/test/CIR/CodeGen/tmp.c":10:7): error: operation with block successors must terminate its parent block
fatal error: error in backend: CIR codegen: module verification error before running CIR passes
It looks like the it generates the break
instruction in the wrong place:
"cir.switch"(%1) <{cases = [#cir.case<value = [], kind = 1 : i32>]}> ({
%2 = "cir.get_global"() <{name = @action1}> : () -> !cir.ptr<!cir.func<!void (...)>> loc(#loc24)
%3 = "cir.cast"(%2) <{kind = 4 : i32}> : (!cir.ptr<!cir.func<!void (...)>>) -> !cir.ptr<!cir.func<!void ()>> loc(#loc24)
"cir.call"(%3) <{ast = #cir.call.expr.ast, calling_conv = 1 : i32, extra_attrs = #fn_attr}> ({
}) : (!cir.ptr<!cir.func<!void ()>>) -> () loc(#loc13)
"cir.br"()[^bb1] : () -> () loc(#loc15) ; problematic
"cir.break"() : () -> () loc(#loc16)
^bb1: // pred: ^bb0
"cir.label"() <{label = "label"}> : () -> () loc(#loc15)
%4 = "cir.get_global"() <{name = @action2}> : () -> !cir.ptr<!cir.func<!void (...)>> loc(#loc25)
%5 = "cir.cast"(%4) <{kind = 4 : i32}> : (!cir.ptr<!cir.func<!void (...)>>) -> !cir.ptr<!cir.func<!void ()>> loc(#loc25)
"cir.call"(%5) <{ast = #cir.call.expr.ast, calling_conv = 1 : i32, extra_attrs = #fn_attr}> ({
}) : (!cir.ptr<!cir.func<!void ()>>) -> () loc(#loc17)
"cir.yield"() : () -> () loc(#loc10)
}) : (!s32i) -> () loc(#loc10)
bcardosolopes
Metadata
Metadata
Assignees
Labels
No labels