aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-29 17:48:21 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-09-01 22:53:30 +0200
commite9c1560304d73c118cf641b318ef8959c01d7463 (patch)
tree2e2133919246e48847b2ce911cdee58d3e50f8ac
parent1b2f4d1229fb2c9d55cbc56be5319c26662c45ca (diff)
downloadsparse-dev-e9c1560304d73c118cf641b318ef8959c01d7463.tar.gz
trivial-phi: make clean_up_phi() more sequential
Reorganize clean_up_phi() so that the tests in the loop are more sequential. It functionally identical but will help to detect other, less trivial, trivial phi-nodes. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--simplify.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/simplify.c b/simplify.c
index e9995a54..f6471a4e 100644
--- a/simplify.c
+++ b/simplify.c
@@ -187,12 +187,13 @@ static int clean_up_phi(struct instruction *insn)
def = phi->def;
if (def->phi_src == VOID || !def->bb)
continue;
- if (last) {
- if (last->phi_src != def->phi_src)
- same = 0;
+ if (!last) {
+ last = def;
continue;
}
- last = def;
+ if (last->phi_src == def->phi_src)
+ continue;
+ same = 0;
} END_FOR_EACH_PTR(phi);
if (same) {