public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* patch to fix PR66424
@ 2015-07-21 20:05 Vladimir Makarov
  2015-09-29 15:22 ` Matthias Klose
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Makarov @ 2015-07-21 20:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

   The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424

   The patch was tested and bootstrapped on x86/x86-64.

   Committed as rev. 226053.

2015-07-21  Vladimir Makarov  <vmakarov@redhat.com>

         PR ipa/66424.
         * lra-remat.c (operand_to_remat): Prevent using insns with input
         subregs processed separately by IRA.

2015-07-21  Vladimir Makarov  <vmakarov@redhat.com>

         PR ipa/66424.
         * gcc.target/i386/pr66424.c: New.



[-- Attachment #2: pr66424.patch --]
[-- Type: text/x-patch, Size: 1742 bytes --]

Index: lra-remat.c
===================================================================
--- lra-remat.c	(revision 225979)
+++ lra-remat.c	(working copy)
@@ -417,6 +417,16 @@ operand_to_remat (rtx_insn *insn)
 	  return -1;
 	found_reg = reg;
       }
+    /* IRA calculates conflicts separately for subregs of two words
+       pseudo.  Even if the pseudo lives, e.g. one its subreg can be
+       used lately, another subreg hard register can be already used
+       for something else.  In such case, it is not safe to
+       rematerialize the insn.  */
+    else if (reg->type == OP_IN && reg->subreg_p
+	     && reg->regno >= FIRST_PSEUDO_REGISTER
+	     && (GET_MODE_SIZE (PSEUDO_REGNO_MODE (reg->regno))
+		 == 2 * UNITS_PER_WORD))
+      return -1;
   if (found_reg == NULL)
     return -1;
   if (found_reg->regno < FIRST_PSEUDO_REGISTER)
Index: testsuite/gcc.target/i386/pr66424.c
===================================================================
--- testsuite/gcc.target/i386/pr66424.c	(revision 0)
+++ testsuite/gcc.target/i386/pr66424.c	(working copy)
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target ia32 } */
+int a, b, c, d, e[2], f, l, m, n, o;
+long long g = 1, j;
+static unsigned int h;
+static int i, k;
+
+void
+fn1 (long long p)
+{
+  int q = p;
+  f = 1 ^ e[f ^ (q & 1)];
+}
+
+static void
+fn2 (long long p)
+{
+  f = 1 ^ e[(f ^ 1) & 1];
+  fn1 (p >> 1 & 1);
+  fn1 (p >> 32 & 1);
+}
+
+void
+fn3 (int p)
+{
+  g |= j = p;
+}
+
+int
+main ()
+{
+  e[0] = 1;
+  char p = l;
+  h = --g;
+  i = o = c;
+  m = d ? 1 / d : 0;
+  fn3 (l || 0);
+  b = a;
+  n = j++;
+  k--;
+  fn2 (g);
+  fn2 (h);
+  fn2 (i);
+
+  if (k + f)
+    __builtin_abort ();
+
+  return 0;
+}
+

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to fix PR66424
  2015-07-21 20:05 patch to fix PR66424 Vladimir Makarov
@ 2015-09-29 15:22 ` Matthias Klose
  2015-09-29 16:55   ` Vladimir Makarov
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Klose @ 2015-09-29 15:22 UTC (permalink / raw)
  To: Vladimir Makarov, gcc-patches

This was marked as a regression in 5 and 6, but never backported to the 
gcc-5-branch. Is it time to backport?

Matthias

On 21.07.2015 21:54, Vladimir Makarov wrote:
>    The following patch fixes
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
>
>    The patch was tested and bootstrapped on x86/x86-64.
>
>    Committed as rev. 226053.
>
> 2015-07-21  Vladimir Makarov  <vmakarov@redhat.com>
>
>          PR ipa/66424.
>          * lra-remat.c (operand_to_remat): Prevent using insns with input
>          subregs processed separately by IRA.
>
> 2015-07-21  Vladimir Makarov  <vmakarov@redhat.com>
>
>          PR ipa/66424.
>          * gcc.target/i386/pr66424.c: New.
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to fix PR66424
  2015-09-29 15:22 ` Matthias Klose
@ 2015-09-29 16:55   ` Vladimir Makarov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2015-09-29 16:55 UTC (permalink / raw)
  To: Matthias Klose, gcc-patches

On 09/29/2015 10:23 AM, Matthias Klose wrote:
> This was marked as a regression in 5 and 6, but never backported to 
> the gcc-5-branch. Is it time to backport?
>
Thanks for the remainder.  I've just committed the patch to gcc 5 branch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-29 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21 20:05 patch to fix PR66424 Vladimir Makarov
2015-09-29 15:22 ` Matthias Klose
2015-09-29 16:55   ` Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).