diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-19 15:22:01 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-09-05 14:09:34 +0200 |
commit | 554f3b2ca09f9e63b364f34a04cd5db22ba26bca (patch) | |
tree | 3efc9bdb07cdc7bae5274c0d42bfb08a78656285 | |
parent | e25db16860b21e1065a7890e308c9236dfbc9a63 (diff) | |
download | sparse-554f3b2ca09f9e63b364f34a04cd5db22ba26bca.tar.gz |
replace_with_{pseudo,value}() can be tail-calls
This avoids the need to have a separate 'return REPEAT_CSE' and
thus make the code slightly more compact and fast to read.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | simplify.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -1153,8 +1153,7 @@ static int simplify_constant_binop(struct instruction *insn) if (!res) return 0; - replace_with_pseudo(insn, res); - return REPEAT_CSE; + return replace_with_pseudo(insn, res); } static int simplify_binop_same_args(struct instruction *insn, pseudo_t arg) @@ -1298,8 +1297,7 @@ static int simplify_constant_unop(struct instruction *insn) mask = 1ULL << (insn->size-1); res &= mask | (mask-1); - replace_with_value(insn, res); - return REPEAT_CSE; + return replace_with_value(insn, res); } static int simplify_unop(struct instruction *insn) @@ -1554,8 +1552,7 @@ static int simplify_select(struct instruction *insn) take = cond->value ? src1 : src2; kill = cond->value ? &insn->src3 : &insn->src2; kill_use(kill); - replace_with_pseudo(insn, take); - return REPEAT_CSE; + return replace_with_pseudo(insn, take); } if (constant(src1) && constant(src2)) { long long val1 = src1->value; @@ -1577,8 +1574,7 @@ static int simplify_select(struct instruction *insn) if (cond == src2 && is_zero(src1)) { kill_use(&insn->src1); kill_use(&insn->src3); - replace_with_value(insn, 0); - return REPEAT_CSE; + return replace_with_value(insn, 0); } return 0; } |