Fix a miscompilation where a reload reg is reused after it has been clobbered.
authorBernd Schmidt <bernds@codesourcery.com>
Tue, 15 Oct 2013 10:36:03 +0000 (10:36 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Tue, 15 Oct 2013 10:36:03 +0000 (10:36 +0000)
* reload1.c (reloads_unique_chain_p): Ensure that r1 is the input for
r2.

From-SVN: r203596

gcc/ChangeLog
gcc/reload1.c

index 39ea2033092c4a0d69b10c9c07910940746dbf7a..6bf624ee9cca5aacbd3ad68cf3337622d27767b7 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-15  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * reload1.c (reloads_unique_chain_p): Ensure that r1 is the input for
+       r2.
+
 2013-10-15  Richard Biener  <rguenther@suse.de>
 
        * tree-loop-distribution.c (build_empty_rdg): Inline into
index bb13bf802d1fc697f356bdb4fb6c5d0f2245917b..d56c554b10db3bbf01bd77a90fa729e0cb7ad334 100644 (file)
@@ -5560,6 +5560,14 @@ reloads_unique_chain_p (int r1, int r2)
            || reg_mentioned_p (rld[r2].in, rld[r1].in)))
     return false;
 
+  /* The following loop assumes that r1 is the reload that feeds r2.  */
+  if (r1 > r2)
+    {
+      int tmp = r2;
+      r2 = r1;
+      r1 = tmp;
+    }
+
   for (i = 0; i < n_reloads; i ++)
     /* Look for input reloads that aren't our two */
     if (i != r1 && i != r2 && rld[i].in)