aboutsummaryrefslogtreecommitdiff
path: root/gcc/auto-inc-dec.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2010-06-07 13:12:42 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2010-06-07 13:12:42 +0000
commit5e52ffc4f0176747fb9290aaa7b9bb7fa9c1b332 (patch)
treee785d101633aa2238c1b438f15db3d87ca4ae178 /gcc/auto-inc-dec.c
parentae0595b089bfb006687b60a0a8a4e6420909424f (diff)
downloadgcc-5e52ffc4f0176747fb9290aaa7b9bb7fa9c1b332.zip
gcc-5e52ffc4f0176747fb9290aaa7b9bb7fa9c1b332.tar.gz
gcc-5e52ffc4f0176747fb9290aaa7b9bb7fa9c1b332.tar.bz2
re PR rtl-optimization/44404 (auto-inc-dec generates an invalid assembly instruction)
gcc/ PR rtl-optimization/44404 * auto-inc-dec.c (find_inc): Use reg_overlap_mentioned_p instead of count_occurrences to see if it's safe to modify mem_insn.insn. gcc/testsuite/ gcc/testsuite/ PR rtl-optimization/44404 * gcc.dg/pr44404.c: New. From-SVN: r160372
Diffstat (limited to 'gcc/auto-inc-dec.c')
-rw-r--r--gcc/auto-inc-dec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 6b5c3ad..94dffc9 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1068,6 +1068,13 @@ find_inc (bool first_try)
/* For the post_add to work, the result_reg of the inc must not be
used in the mem insn since this will become the new index
register. */
+ if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) == 0
+ && reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn)))
+ {
+ debug_rtx (mem_insn.insn);
+ debug_rtx (inc_insn.reg_res);
+ gcc_unreachable ();
+ }
if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) != 0)
{
if (dump_file)