diff options
author | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2015-11-27 09:49:38 +0000 |
---|---|---|
committer | Kyrylo Tkachov <ktkachov@gcc.gnu.org> | 2015-11-27 09:49:38 +0000 |
commit | 14af28ba5aa467556c30cf20a8ee27e83590314f (patch) | |
tree | 6463d274e25248bb8242dc2712931f48af657065 /gcc/ifcvt.c | |
parent | b58d3df29fd0c37a2d5115fc9c708cffcc379ffc (diff) | |
download | gcc-14af28ba5aa467556c30cf20a8ee27e83590314f.zip gcc-14af28ba5aa467556c30cf20a8ee27e83590314f.tar.gz gcc-14af28ba5aa467556c30cf20a8ee27e83590314f.tar.bz2 |
[RTL-ifcvt] PR rtl-optimization/68506: Fix emitting order of insns in IF-THEN-JOIN case
PR rtl-optimization/68506
* ifcvt.c (noce_try_cmove_arith): Try emitting the else basic block
first if emit_a exists or then_bb modifies 'b'. Reindent if-else
blocks.
* gcc.c-torture/execute/pr68506.c: New test.
From-SVN: r231003
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r-- | gcc/ifcvt.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index fc724bc..8ece873 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2190,40 +2190,38 @@ noce_try_cmove_arith (struct noce_if_info *if_info) } } - if (emit_a && modified_in_a) - { - modified_in_b = emit_b != NULL_RTX && modified_in_p (orig_a, emit_b); - if (tmp_b && else_bb) - { - FOR_BB_INSNS (else_bb, tmp_insn) - /* Don't check inside insn_b. We will have changed it to emit_b - with a destination that doesn't conflict. */ - if (!(insn_b && tmp_insn == insn_b) - && modified_in_p (orig_a, tmp_insn)) - { - modified_in_b = true; - break; - } - - } - if (modified_in_b) - goto end_seq_and_fail; - - if (!noce_emit_bb (emit_b, else_bb, b_simple)) - goto end_seq_and_fail; + if (emit_a || modified_in_a) + { + modified_in_b = emit_b != NULL_RTX && modified_in_p (orig_a, emit_b); + if (tmp_b && else_bb) + { + FOR_BB_INSNS (else_bb, tmp_insn) + /* Don't check inside insn_b. We will have changed it to emit_b + with a destination that doesn't conflict. */ + if (!(insn_b && tmp_insn == insn_b) + && modified_in_p (orig_a, tmp_insn)) + { + modified_in_b = true; + break; + } + } + if (modified_in_b) + goto end_seq_and_fail; - if (!noce_emit_bb (emit_a, then_bb, a_simple)) - goto end_seq_and_fail; - } - else - { - if (!noce_emit_bb (emit_a, then_bb, a_simple)) - goto end_seq_and_fail; + if (!noce_emit_bb (emit_b, else_bb, b_simple)) + goto end_seq_and_fail; - if (!noce_emit_bb (emit_b, else_bb, b_simple)) - goto end_seq_and_fail; + if (!noce_emit_bb (emit_a, then_bb, a_simple)) + goto end_seq_and_fail; + } + else + { + if (!noce_emit_bb (emit_a, then_bb, a_simple)) + goto end_seq_and_fail; - } + if (!noce_emit_bb (emit_b, else_bb, b_simple)) + goto end_seq_and_fail; + } target = noce_emit_cmove (if_info, x, code, XEXP (if_info->cond, 0), XEXP (if_info->cond, 1), a, b); |