diff options
author | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2015-11-25 09:48:29 +0000 |
---|---|---|
committer | Kyrylo Tkachov <ktkachov@gcc.gnu.org> | 2015-11-25 09:48:29 +0000 |
commit | 9b71b2ab84caafd7f32429772745f9b07d85321f (patch) | |
tree | 8ed5dd2cf71d54db7868906cf1d7697edd40ef9b /gcc/ifcvt.c | |
parent | 514c0e7c12d44576796d79079b1ba20844f047b9 (diff) | |
download | gcc-9b71b2ab84caafd7f32429772745f9b07d85321f.zip gcc-9b71b2ab84caafd7f32429772745f9b07d85321f.tar.gz gcc-9b71b2ab84caafd7f32429772745f9b07d85321f.tar.bz2 |
[RTL-ifcvt] PR rtl-optimization/68435 Allow (c ? x++ : x--) form
PR rtl-optimization/68435
* ifcvt.c (noce_try_cmove_arith): Skip final insn when checking
for conflicts between a, b and the set destinations.
* gcc.dg/pr68435.c: New test.
From-SVN: r230859
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r-- | gcc/ifcvt.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index eb5cae5..212d320 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2180,7 +2180,10 @@ noce_try_cmove_arith (struct noce_if_info *if_info) if (tmp_b && then_bb) { FOR_BB_INSNS (then_bb, tmp_insn) - if (modified_in_p (orig_b, tmp_insn)) + /* Don't check inside insn_a. We will have changed it to emit_a + with a destination that doesn't conflict. */ + if (!(insn_a && tmp_insn == insn_a) + && modified_in_p (orig_b, tmp_insn)) { modified_in_a = true; break; @@ -2193,7 +2196,10 @@ noce_try_cmove_arith (struct noce_if_info *if_info) if (tmp_b && else_bb) { FOR_BB_INSNS (else_bb, tmp_insn) - if (modified_in_p (orig_a, 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; |