gcc/
authoryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Dec 2014 14:19:00 +0000 (14:19 +0000)
committeryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Dec 2014 14:19:00 +0000 (14:19 +0000)
2014-12-04  Yvan Roux  <yvan.roux@linaro.org>

Backport from trunk r215540.
2014-09-24  Zhenqiang Chen  <zhenqiang.chen@arm.com>

PR rtl-optimization/63210
* ira-color.c (assign_hard_reg): Ignore conflict cost if the
HARD_REGNO is not available for CONFLICT_A.

gcc/testsuite/
2014-12-04  Yvan Roux  <yvan.roux@linaro.org>

Backport from trunk r215540.
2014-09-24  Zhenqiang Chen  <zhenqiang.chen@arm.com>

* gcc.target/arm/pr63210.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@218368 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.linaro
gcc/ira-color.c
gcc/testsuite/ChangeLog.linaro
gcc/testsuite/gcc.target/arm/pr63210.c [new file with mode: 0644]

index 3b64a4d..63c27b9 100644 (file)
@@ -1,5 +1,14 @@
 2014-12-04  Yvan Roux  <yvan.roux@linaro.org>
 
+       Backport from trunk r215540.
+       2014-09-24  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+       PR rtl-optimization/63210
+       * ira-color.c (assign_hard_reg): Ignore conflict cost if the
+       HARD_REGNO is not available for CONFLICT_A.
+
+2014-12-04  Yvan Roux  <yvan.roux@linaro.org>
+
        Backport from trunk r215046.
        2014-09-09  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
index 1f4c96e..0562367 100644 (file)
@@ -1711,6 +1711,7 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
         {
          ira_allocno_t conflict_a = OBJECT_ALLOCNO (conflict_obj);
          enum reg_class conflict_aclass;
+         allocno_color_data_t data = ALLOCNO_COLOR_DATA (conflict_a);
 
          /* Reload can give another class so we need to check all
             allocnos.  */
@@ -1782,7 +1783,12 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
                    hard_regno = ira_class_hard_regs[aclass][j];
                    ira_assert (hard_regno >= 0);
                    k = ira_class_hard_reg_index[conflict_aclass][hard_regno];
-                   if (k < 0)
+                   if (k < 0
+                          /* If HARD_REGNO is not available for CONFLICT_A,
+                             the conflict would be ignored, since HARD_REGNO
+                             will never be assigned to CONFLICT_A.  */
+                       || !TEST_HARD_REG_BIT (data->profitable_hard_regs,
+                                              hard_regno))
                      continue;
                    full_costs[j] -= conflict_costs[k];
                  }
index effd028..1ef31cf 100644 (file)
@@ -1,5 +1,12 @@
 2014-12-04  Yvan Roux  <yvan.roux@linaro.org>
 
+       Backport from trunk r215540.
+       2014-09-24  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+       * gcc.target/arm/pr63210.c: New test.
+
+2014-12-04  Yvan Roux  <yvan.roux@linaro.org>
+
        Backport from trunk r215475.
        2014-09-22  Alan Lawrence  <alan.lawrence@arm.com>
 
diff --git a/gcc/testsuite/gcc.target/arm/pr63210.c b/gcc/testsuite/gcc.target/arm/pr63210.c
new file mode 100644 (file)
index 0000000..c3ae928
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do assemble } */
+/* { dg-options "-mthumb -Os " }  */
+/* { dg-require-effective-target arm_thumb1_ok } */
+
+int foo1 (int c);
+int foo2 (int c);
+
+int test (int c)
+{
+  return (foo1 (c) || foo2 (c));
+}
+/* { dg-final { object-size text <= 28 } } */