re PR rtl-optimization/56847 ('-fpie' triggers - internal compiler error: in gen_add2...
authorVladimir Makarov <vmakarov@redhat.com>
Fri, 19 Apr 2013 19:55:57 +0000 (19:55 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Fri, 19 Apr 2013 19:55:57 +0000 (19:55 +0000)
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.

From-SVN: r198101

gcc/ChangeLog
gcc/lra-constraints.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr56847.c [new file with mode: 0644]

index e2aca327abe279226251ed71c4eef2d4f40dd9bf..c27e4da878a01394f348bb4e2d64ab75d6dfe600 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2013-04-19  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/56982
index e3b4add9f18bf51023b19a5ad263d389e89c3c2c..9e4924c50814f84478ab34b22d25540feaff1a8d 100644 (file)
@@ -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
index a31889a3b29054d675b06b1575f78793994d287b..7227e5e34e5c51e350938cb5f64474c46d157451 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-19  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/56847
+       * gcc.dg/pr56847.c: New test.
+
 2013-04-19  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/56982
diff --git a/gcc/testsuite/gcc.dg/pr56847.c b/gcc/testsuite/gcc.dg/pr56847.c
new file mode 100644 (file)
index 0000000..b94aae1
--- /dev/null
@@ -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;
+}