From: Richard Henderson Date: Thu, 24 Oct 2002 09:02:24 +0000 (-0700) Subject: reload.c (find_reloads_toplev): Mode of X is not important when simplifying subregs... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3bd216f20128fabe1659826cc5717f2f4c7f8f71;p=gcc.git reload.c (find_reloads_toplev): Mode of X is not important when simplifying subregs of constants. * reload.c (find_reloads_toplev): Mode of X is not important when simplifying subregs of constants. * g++.dg/opt/reload1.C: New. From-SVN: r58490 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e485a49eda4..7f368957a55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-10-24 Richard Henderson + + PR opt/7944 + * reload.c (find_reloads_toplev): Mode of X is not important + when simplifying subregs of constants. + 2002-10-24 Richard Sandiford * config.gcc (mips64vr-*-elf*, mips64vrel-*-elf*): Add diff --git a/gcc/reload.c b/gcc/reload.c index 9b779beeabc..d500350f868 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -4471,8 +4471,7 @@ find_reloads_toplev (x, opnum, type, ind_levels, is_set_dest, insn, reg_equiv_constant[regno])) != 0) return tem; - if (GET_MODE_BITSIZE (GET_MODE (x)) == BITS_PER_WORD - && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0 + if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0 && reg_equiv_constant[regno] != 0) { tem = diff --git a/gcc/testsuite/g++.dg/opt/reload1.C b/gcc/testsuite/g++.dg/opt/reload1.C new file mode 100644 index 00000000000..0d8fb894e4e --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/reload1.C @@ -0,0 +1,43 @@ +// PR 7944 +// { dg-do compile } +// { dg-options -O2 } + +struct B +{ + B & operator << (short s) + { + int j; + if (j) + return operator << (s); + else + return operator << (s); + } +}; + +struct A +{ + int i; + static void bar (); + static int quux () + { + bar (); + return 0; + } + + A ():i (quux ()) + { + } + ~A () + { + } +}; + +void +foo () +{ + short s[4] = { 0, 0, 0, 1 }; + A a[2] = { A (), A () }; + + B b; + b << s[0] << s[2]; +}