From c73d295c48fd246c2fd85827ab798e894f600033 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 16 Mar 2016 18:52:20 +0100 Subject: re PR middle-end/70245 (Miscompilation of ICU on i386 with atom tuning starting with r227382) PR target/70245 * rtlanal.c (replace_rtx): For REG, if from is a REG, return to even if only REGNO is equal, and assert mode is the same. * g++.dg/opt/pr70245.C: New test. * g++.dg/opt/pr70245.h: New file. * g++.dg/opt/pr70245-aux.cc: New file. Co-Authored-By: Richard Biener From-SVN: r234265 --- gcc/rtlanal.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/rtlanal.c') diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index bacc5f2..74b593d 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -2961,7 +2961,16 @@ replace_rtx (rtx x, rtx from, rtx to) if (x == 0) return 0; - if (GET_CODE (x) == SUBREG) + if (GET_CODE (x) == REG) + { + if (GET_CODE (from) == REG + && REGNO (x) == REGNO (from)) + { + gcc_assert (GET_MODE (x) == GET_MODE (from)); + return to; + } + } + else if (GET_CODE (x) == SUBREG) { rtx new_rtx = replace_rtx (SUBREG_REG (x), from, to); -- cgit v1.1