This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch][google/gcc-4_8] Backport r198101 (fix for PR56847) into google/gcc-4_8


Hi, this patch back port trunk@198101 to fix PR rtl-optimization/56847.

Passed bootstrap and regression test.

Ok for branch google/gcc-4_8?

2013-04-19  Vladimir Makarov  <vmakarov@redhat.com>

        PR rtl-optimization/56847
        * lra-constraints.c (process_alt_operands): Discourage alternative
        with non-matche doffsettable memory constraint fro memory with
        known offset.

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index e3b4add..9e4924c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -1978,8 +1978,15 @@ process_alt_operands (int only_alternative)
       (op, this_alternative) == NO_REGS))))
  reject += LRA_MAX_REJECT;

-      if (! ((const_to_mem && constmemok)
-     || (MEM_P (op) && offmemok)))
+      if (MEM_P (op) && offmemok)
+ {
+  /* If we know offset and this non-offsetable memory,
+     something wrong with this memory and it is better
+     to try other memory possibilities.  */
+  if (MEM_OFFSET_KNOWN_P (op))
+    reject += LRA_MAX_REJECT;
+ }
+      else if (! (const_to_mem && constmemok))
  {
   /* We prefer to reload pseudos over reloading other
      things, since such reloads may be able to be
diff --git a/gcc/testsuite/gcc.dg/pr56847.c b/gcc/testsuite/gcc.dg/pr56847.c
new file mode 100644
index 0000000..b94aae1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr56847.c
@@ -0,0 +1,12 @@
+/* PR rtl-optimization/56847 */
+/* { dg-do compile { target pie } } */
+/* { dg-options "-O2 -fpie" } */
+
+struct S { long int a, b; } e;
+__thread struct S s;
+
+void
+foo (void)
+{
+  s = e;
+}


H.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]