diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-16 17:52:20 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-16 17:52:20 +0000 |
commit | 867c9e995539beefa594475f2bd831438e36a077 (patch) | |
tree | 0708e09e5edd3bef4be596c6056156cb9c994023 /gcc/rtlanal.c | |
parent | 8ced6ab75a3a0fcdf1a50ee4d8b0bb57e517ff7b (diff) | |
download | gcc-867c9e995539beefa594475f2bd831438e36a077.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234265 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index bacc5f25f4a..74b593d6935 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); |