]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/52804 (IRA/RELOAD allocate wrong register on ARM for cortex-m0)
authorBin Cheng <bin.cheng@arm.com>
Fri, 4 May 2012 02:52:27 +0000 (02:52 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Fri, 4 May 2012 02:52:27 +0000 (02:52 +0000)
PR rtl-optimization/52804
* reload1.c (reload_reg_reaches_end_p): Check whether successor
reload with type RELOAD_FOR_INPUT_ADDRESS kills reload register
of current one with type RELOAD_FOR_INPADDR_ADDRESS.
Same stands for reloads with type RELOAD_FOR_OUTPUT_ADDRESS and
RELOAD_FOR_OUTADDR_ADDRESS.

From-SVN: r187139

gcc/ChangeLog
gcc/reload1.c

index 635e914b3896c713ad7309a63c4a02f7ff13cf6f..746087a0aae5c93a577d2fe1ed0354c4d85211b2 100644 (file)
@@ -1,3 +1,12 @@
+2012-05-04  Bin Cheng  <bin.cheng@arm.com>
+
+       PR rtl-optimization/52804
+       * reload1.c (reload_reg_reaches_end_p): Check whether successor
+       reload with type RELOAD_FOR_INPUT_ADDRESS kills reload register
+       of current one with type RELOAD_FOR_INPADDR_ADDRESS.
+       Same stands for reloads with type RELOAD_FOR_OUTPUT_ADDRESS and
+       RELOAD_FOR_OUTADDR_ADDRESS.
+
 2012-05-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c++/24985
index 71cea8171d4e24ca6b22f053d2768afab60ab072..359a89313f090ec487246bbc2fc9a6122b0dbd71 100644 (file)
@@ -5429,6 +5429,13 @@ reload_reg_reaches_end_p (unsigned int regno, int reloadnum)
        if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
          return 0;
 
+      /* Reload register of reload with type RELOAD_FOR_INPADDR_ADDRESS
+        could be killed if the register is also used by reload with type
+        RELOAD_FOR_INPUT_ADDRESS, so check it.  */
+      if (type == RELOAD_FOR_INPADDR_ADDRESS
+         && TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[opnum], regno))
+       return 0;
+
       for (i = opnum + 1; i < reload_n_operands; i++)
        if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
            || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno))
@@ -5503,6 +5510,13 @@ reload_reg_reaches_end_p (unsigned int regno, int reloadnum)
            || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno))
          return 0;
 
+      /* Reload register of reload with type RELOAD_FOR_OUTADDR_ADDRESS
+        could be killed if the register is also used by reload with type
+        RELOAD_FOR_OUTPUT_ADDRESS, so check it.  */
+      if (type == RELOAD_FOR_OUTADDR_ADDRESS
+         && TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[opnum], regno))
+       return 0;
+
       return 1;
 
     default: