Skip to content

Commit 23d3399

Browse files
committed
Refactor code style for improved readability
Remove unnecessary braces from single-line if statements and add consistent spacing around comments for better code clarity.
1 parent bbd5b41 commit 23d3399

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/ssa.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,12 @@ void build_r_idom(void)
298298
pred = bb->then_;
299299
}
300300

301-
if (bb->next && bb->next != pred && bb->next->r_idom) {
301+
if (bb->next && bb->next != pred && bb->next->r_idom)
302302
pred = reverse_intersect(bb->next, pred);
303-
}
304-
if (bb->else_ && bb->else_ != pred && bb->else_->r_idom) {
303+
if (bb->else_ && bb->else_ != pred && bb->else_->r_idom)
305304
pred = reverse_intersect(bb->else_, pred);
306-
}
307-
if (bb->then_ && bb->then_ != pred && bb->then_->r_idom) {
305+
if (bb->then_ && bb->then_ != pred && bb->then_->r_idom)
308306
pred = reverse_intersect(bb->then_, pred);
309-
}
310307
if (bb->r_idom != pred) {
311308
bb->r_idom = pred;
312309
changed = true;
@@ -320,6 +317,7 @@ bool rdom_connect(basic_block_t *pred, basic_block_t *succ)
320317
{
321318
if (succ->rdom_prev)
322319
return false;
320+
323321
int i;
324322
for (i = 0; i < MAX_BB_RDOM_SUCC; i++) {
325323
if (pred->rdom_next[i] == succ)
@@ -649,11 +647,12 @@ void solve_phi_insertion(void)
649647
if (var->is_ternary_ret || var->is_logical_ret)
650648
continue;
651649

652-
for (int l = 0; l < work_list_idx; l++)
650+
for (int l = 0; l < work_list_idx; l++) {
653651
if (work_list[l] == df) {
654652
found = true;
655653
break;
656654
}
655+
}
657656
if (!found)
658657
work_list[work_list_idx++] = df;
659658
}
@@ -1489,8 +1488,7 @@ void dce_sweep(void)
14891488
for (insn_t *insn = bb->insn_list.head; insn; insn = insn->next) {
14901489
if (insn->useful)
14911490
continue;
1492-
/*
1493-
* If a branch instruction is useless, redirect to the
1491+
/* If a branch instruction is useless, redirect to the
14941492
* reverse immediate dominator of this basic block and
14951493
* remove the branch instruction. Later, register allocation
14961494
* will insert a jump instruction.
@@ -1507,6 +1505,7 @@ void dce_sweep(void)
15071505
jump_bb = jump_bb->r_idom;
15081506
}
15091507
}
1508+
15101509
/* remove useless instructions */
15111510
if (insn->next)
15121511
insn->next->prev = insn->prev;

0 commit comments

Comments
 (0)