PR rtl-optimization/23233
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Aug 2005 11:05:48 +0000 (11:05 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Aug 2005 11:05:48 +0000 (11:05 +0000)
* loop.c (combine_movables): Require the modes to be the same.
(move_movables): Remove handling of cases where the replacement
had a different mode to the original.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102804 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/loop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr23233-1.c [new file with mode: 0644]

index db61463..7f74051 100644 (file)
@@ -1,3 +1,10 @@
+2005-08-06  Richard Sandiford  <richard@codesourcery.com>
+
+       PR rtl-optimization/23233
+       * loop.c (combine_movables): Require the modes to be the same.
+       (move_movables): Remove handling of cases where the replacement
+       had a different mode to the original.
+
 2005-08-05  James A. Morrison  <phython@gcc.gnu.org>
 
        PR tree-optimization/23128
index a904881..bc6ddec 100644 (file)
@@ -1881,19 +1881,7 @@ combine_movables (struct loop_movables *movables, struct loop_regs *regs)
              && !m1->partial
              && (matched_regs[m1->regno]
                  ||
-                 (
-                  /* Can combine regs with different modes loaded from the
-                     same constant only if the modes are the same or
-                     if both are integer modes with M wider or the same
-                     width as M1.  The check for integer is redundant, but
-                     safe, since the only case of differing destination
-                     modes with equal sources is when both sources are
-                     VOIDmode, i.e., CONST_INT.  */
-                  (GET_MODE (m->set_dest) == GET_MODE (m1->set_dest)
-                   || (GET_MODE_CLASS (GET_MODE (m->set_dest)) == MODE_INT
-                       && GET_MODE_CLASS (GET_MODE (m1->set_dest)) == MODE_INT
-                       && (GET_MODE_BITSIZE (GET_MODE (m->set_dest))
-                           >= GET_MODE_BITSIZE (GET_MODE (m1->set_dest)))))
+                 (GET_MODE (m->set_dest) == GET_MODE (m1->set_dest)
                   /* See if the source of M1 says it matches M.  */
                   && ((REG_P (m1->set_src)
                        && matched_regs[REGNO (m1->set_src)])
@@ -2657,23 +2645,7 @@ move_movables (struct loop *loop, struct loop_movables *movables,
                    {
                      rtx temp;
 
-                     /* Schedule the reg loaded by M1
-                        for replacement so that shares the reg of M.
-                        If the modes differ (only possible in restricted
-                        circumstances, make a SUBREG.
-
-                        Note this assumes that the target dependent files
-                        treat REG and SUBREG equally, including within
-                        GO_IF_LEGITIMATE_ADDRESS and in all the
-                        predicates since we never verify that replacing the
-                        original register with a SUBREG results in a
-                        recognizable insn.  */
-                     if (GET_MODE (m->set_dest) == GET_MODE (m1->set_dest))
-                       reg_map[m1->regno] = m->set_dest;
-                     else
-                       reg_map[m1->regno]
-                         = gen_lowpart_common (GET_MODE (m1->set_dest),
-                                               m->set_dest);
+                     reg_map[m1->regno] = m->set_dest;
 
                      /* Get rid of the matching insn
                         and prevent further processing of it.  */
index 5f0466a..0097a9d 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-06  Richard Sandiford  <richard@codesourcery.com>
+
+       PR rtl-optimization/23233
+       * gcc.c-torture/compile/pr23233-1.c: New test.
+
 2005-08-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/18833
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c b/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c
new file mode 100644 (file)
index 0000000..356c063
--- /dev/null
@@ -0,0 +1,8 @@
+void foo (volatile long long *x)
+{
+  while (*x)
+    {
+      *x = 0;
+      *((volatile char *) 0) = 0;
+    }
+}