forked from suyu/suyu
structured_control_flow: Skip reordering nested demote branches.
Nested demote branches add complexity with combining the condition if it has not been initialized yet. Skip them for the time being.
This commit is contained in:
parent
4fda7f1c82
commit
907dfbea71
1 changed files with 11 additions and 0 deletions
|
@ -872,10 +872,21 @@ private:
|
||||||
std::vector<IR::Block*> demote_blocks;
|
std::vector<IR::Block*> demote_blocks;
|
||||||
std::vector<IR::U1> demote_conds;
|
std::vector<IR::U1> demote_conds;
|
||||||
u32 num_epilogues{};
|
u32 num_epilogues{};
|
||||||
|
u32 branch_depth{};
|
||||||
for (const IR::AbstractSyntaxNode& node : syntax_list) {
|
for (const IR::AbstractSyntaxNode& node : syntax_list) {
|
||||||
|
if (node.type == Type::If) {
|
||||||
|
++branch_depth;
|
||||||
|
}
|
||||||
|
if (node.type == Type::EndIf) {
|
||||||
|
--branch_depth;
|
||||||
|
}
|
||||||
if (node.type != Type::Block) {
|
if (node.type != Type::Block) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (branch_depth > 1) {
|
||||||
|
// Skip reordering nested demote branches.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (const IR::Inst& inst : node.data.block->Instructions()) {
|
for (const IR::Inst& inst : node.data.block->Instructions()) {
|
||||||
const IR::Opcode op{inst.GetOpcode()};
|
const IR::Opcode op{inst.GetOpcode()};
|
||||||
if (op == IR::Opcode::DemoteToHelperInvocation) {
|
if (op == IR::Opcode::DemoteToHelperInvocation) {
|
||||||
|
|
Loading…
Reference in a new issue