diff mbox

patch to fix PR58335

Message ID 5239F158.3020907@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov Sept. 18, 2013, 6:30 p.m. UTC
On 09/12/2013 02:27 PM, Vladimir Makarov wrote:
>   The following patch fixes
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58335
>
>   It required to implement a new approach for elimination updates for
> insn frame_pointer = hard_frame_pointer + offset.  The previous
> implementation used parsing insns generated for offset elimination for
> given insn.  It is hard to parse all possible variants for such
> elimination on different targets.  For example, s390 code is quite
> different from x86/x86-64 code and that was the reason for the PR.
> The new implementation uses temporarily REG_EQUAL notes to avoid
> generated insns
> parsing.  It solves the problem and makes LRA more portable.
>
>   The patch was successfully bootstrapped and tested on x86/x86-64 and s390.
>
> Committed as rev. 202536.

It is actually 202714.
>
> 2013-09-12  Vladimir Makarov  <vmakarov@redhat.com>
>
>         PR middle-end/58335
>         * lra-eliminations.c (remove_reg_equal_offset_note): New.
>         (eliminate_regs_in_insn): Rewrite frame pointer to hard frame
>         pointer elimination with using remove_reg_equal_offset_note.
>
Sorry, I missed to commit the test suite.

The patch is in attachment.

Committed as rev. 202715.
diff mbox

Patch

Index: testsuite/g++.dg/pr58438.C
===================================================================
--- testsuite/g++.dg/pr58438.C	(revision 0)
+++ testsuite/g++.dg/pr58438.C	(working copy)
@@ -0,0 +1,45 @@ 
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-march=amdfam10 -O3 -fprofile-generate" } */
+enum gimple_code {};
+struct A {
+  gimple_code code;
+};
+struct B {
+  A gsbase;
+};
+int **a;
+int b, d, e, f, g, h, i, j, k, l, m, n, o;
+gimple_code c, p;
+class C {
+  virtual unsigned m_fn1();
+};
+B q;
+static int fn1() {
+  int r;
+  if (k)
+    i = 0;
+  for (; i; j++) {
+    b = c <= 0;
+    if (b)
+      n = *a[0];
+    b = p && c;
+    if (b)
+      r = *a[0];
+    b = q.gsbase.code && c;
+    if (b)
+      o = *a[0];
+    m = o;
+    if (e || 1 & r || d || l)
+      return 0;
+  }
+}
+
+class D : C {
+  unsigned m_fn1() {
+    fn1();
+    for (; h; g++)
+      for (;; f++)
+        ;
+  }
+};
+void fn2() { new D; }