From 8c8fe66309a90e2fffd1515650321ca934857357 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 17 Oct 2014 06:36:35 +0000 Subject: [PATCH] Handle copy cycles in pass_cprop_hardreg 2014-10-17 Tom de Vries PR rtl-optimization/61605 * regcprop.c (copyprop_hardreg_forward_1): Add copy_p and noop_p. Don't notice stores for noops. Don't regard noops as copies. From-SVN: r216364 --- gcc/ChangeLog | 6 ++++++ gcc/regcprop.c | 19 ++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b6f696e687..af302053b98 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-10-17 Tom de Vries + + PR rtl-optimization/61605 + * regcprop.c (copyprop_hardreg_forward_1): Add copy_p and noop_p. Don't + notice stores for noops. Don't regard noops as copies. + 2014-10-17 Uros Bizjak * config/i386/cpuid.h (__cpuid): Remove definitions that handle %ebx diff --git a/gcc/regcprop.c b/gcc/regcprop.c index 7035a84a649..015366b34d5 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -1047,12 +1047,21 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd) } } - /* Notice stores. */ - note_stores (PATTERN (insn), kill_set_value, &ksvd); + bool copy_p = (set + && REG_P (SET_DEST (set)) + && REG_P (SET_SRC (set))); + bool noop_p = (copy_p + && rtx_equal_p (SET_DEST (set), SET_SRC (set))); - /* Notice copies. */ - if (set && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set))) - copy_value (SET_DEST (set), SET_SRC (set), vd); + if (!noop_p) + { + /* Notice stores. */ + note_stores (PATTERN (insn), kill_set_value, &ksvd); + + /* Notice copies. */ + if (copy_p) + copy_value (SET_DEST (set), SET_SRC (set), vd); + } if (insn == BB_END (bb)) break; -- 2.30.2