* [Patch 4.6 only] Fix PR48308.
@ 2013-04-04 14:54 Ramana Radhakrishnan
2013-04-04 14:59 ` Jakub Jelinek
0 siblings, 1 reply; 3+ messages in thread
From: Ramana Radhakrishnan @ 2013-04-04 14:54 UTC (permalink / raw)
To: gcc-patches@gcc.gnu.org ;; +Cc: Jakub Jelinek
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Hi,
This backports the fix for PR48308 something that's slipped through the
cracks. I wrote the backport and then noticed that Mikael had a similar
solution - the only difference being around this guarded for HAVE_cc0
targets.
Tested cross arm-none-linux-gnueabi - no regressions.
Bootstrapped with i686-pc-linux-gnu , regression tests running.
Ok to commit if no regressions ?
Ramana
PR rtl-optimization/48308
* combine.c (enum undo_kind): Add UNDO_LINKS.
(do_SUBST): Check for oldval.
(do_SUBST_LINK): Define.
(SUBST_LINK): Define.
(try_combine): Use SUBST_LINK.
(undo_all): Handle UNDO_LINKS.
[-- Attachment #2: pr48308-46.txt --]
[-- Type: text/plain, Size: 2542 bytes --]
Index: gcc/combine.c
===================================================================
--- gcc/combine.c (revision 196903)
+++ gcc/combine.c (working copy)
@@ -341,14 +341,14 @@
/* Record one modification to rtl structure
to be undone by storing old_contents into *where. */
-enum undo_kind { UNDO_RTX, UNDO_INT, UNDO_MODE };
+enum undo_kind { UNDO_RTX, UNDO_INT, UNDO_MODE, UNDO_LINKS };
struct undo
{
struct undo *next;
enum undo_kind kind;
- union { rtx r; int i; enum machine_mode m; } old_contents;
- union { rtx *r; int *i; } where;
+ union { rtx r; int i; enum machine_mode m; rtx l;} old_contents;
+ union { rtx *r; int *i; rtx *l; } where;
};
/* Record a bunch of changes to be undone, up to MAX_UNDO of them.
@@ -671,7 +671,8 @@
that are perfectly valid, so we'd waste too much effort for
little gain doing the checks here. Focus on catching invalid
transformations involving integer constants. */
- if (GET_MODE_CLASS (GET_MODE (oldval)) == MODE_INT
+ if (oldval
+ && GET_MODE_CLASS (GET_MODE (oldval)) == MODE_INT
&& CONST_INT_P (newval))
{
/* Sanity check that we're replacing oldval with a CONST_INT
@@ -762,6 +763,32 @@
}
#define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE(&(INTO), (NEWVAL))
+
+
+/* Similar to SUBST, but NEWVAL is a LOG_LINKS expression. */
+
+static void
+do_SUBST_LINK (rtx *into, rtx newval)
+{
+ struct undo *buf;
+ rtx oldval = *into;
+ if (oldval == newval)
+ return;
+
+ if (undobuf.frees)
+ buf = undobuf.frees, undobuf.frees = buf->next;
+ else
+ buf = XNEW (struct undo);
+
+ buf->kind = UNDO_LINKS;
+ buf->where.l = into;
+ buf->old_contents.l = oldval;
+ *into = newval;
+
+ buf->next = undobuf.undos, undobuf.undos = buf;
+}
+
+#define SUBST_LINK(oldval, newval) do_SUBST_LINK (&oldval, newval)
\f
/* Subroutine of try_combine. Determine whether the combine replacement
patterns NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to
@@ -2871,6 +2898,7 @@
SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0));
SUBST (XEXP (SET_SRC (PATTERN (i2)), 0),
SET_DEST (PATTERN (i1)));
+ SUBST_LINK (LOG_LINKS (i2), alloc_INSN_LIST (i1, LOG_LINKS (i2)));
}
}
#endif
@@ -4474,6 +4502,11 @@
case UNDO_MODE:
adjust_reg_mode (*undo->where.r, undo->old_contents.m);
break;
+
+ case UNDO_LINKS:
+ *undo->where.l = undo->old_contents.l;
+ break;
+
default:
gcc_unreachable ();
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch 4.6 only] Fix PR48308.
2013-04-04 14:54 [Patch 4.6 only] Fix PR48308 Ramana Radhakrishnan
@ 2013-04-04 14:59 ` Jakub Jelinek
2013-04-04 19:50 ` Ramana Radhakrishnan
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2013-04-04 14:59 UTC (permalink / raw)
To: Ramana Radhakrishnan; +Cc: gcc-patches@gcc.gnu.org ;
On Thu, Apr 04, 2013 at 02:11:39PM +0100, Ramana Radhakrishnan wrote:
>
> This backports the fix for PR48308 something that's slipped through
> the cracks. I wrote the backport and then noticed that Mikael had a
> similar solution - the only difference being around this guarded for
> HAVE_cc0 targets.
>
> Tested cross arm-none-linux-gnueabi - no regressions.
>
> Bootstrapped with i686-pc-linux-gnu , regression tests running.
>
> Ok to commit if no regressions ?
Ok.
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch 4.6 only] Fix PR48308.
2013-04-04 14:59 ` Jakub Jelinek
@ 2013-04-04 19:50 ` Ramana Radhakrishnan
0 siblings, 0 replies; 3+ messages in thread
From: Ramana Radhakrishnan @ 2013-04-04 19:50 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
On 04/04/13 14:16, Jakub Jelinek wrote:
> On Thu, Apr 04, 2013 at 02:11:39PM +0100, Ramana Radhakrishnan wrote:
>>
>> This backports the fix for PR48308 something that's slipped through
>> the cracks. I wrote the backport and then noticed that Mikael had a
>> similar solution - the only difference being around this guarded for
>> HAVE_cc0 targets.
>>
>> Tested cross arm-none-linux-gnueabi - no regressions.
>>
>> Bootstrapped with i686-pc-linux-gnu , regression tests running.
>>
>> Ok to commit if no regressions ?
>
> Ok.
>
> Jakub
>
Thanks - this is what I will commit once testing completes.
Ramana
[-- Attachment #2: gcc46-pr48308.txt --]
[-- Type: text/plain, Size: 2482 bytes --]
Index: combine.c
===================================================================
--- combine.c (revision 197476)
+++ combine.c (working copy)
@@ -341,14 +341,14 @@
/* Record one modification to rtl structure
to be undone by storing old_contents into *where. */
-enum undo_kind { UNDO_RTX, UNDO_INT, UNDO_MODE };
+enum undo_kind { UNDO_RTX, UNDO_INT, UNDO_MODE, UNDO_LINKS };
struct undo
{
struct undo *next;
enum undo_kind kind;
union { rtx r; int i; enum machine_mode m; } old_contents;
- union { rtx *r; int *i; } where;
+ union { rtx *r; int *i; } where;
};
/* Record a bunch of changes to be undone, up to MAX_UNDO of them.
@@ -671,7 +671,8 @@
that are perfectly valid, so we'd waste too much effort for
little gain doing the checks here. Focus on catching invalid
transformations involving integer constants. */
- if (GET_MODE_CLASS (GET_MODE (oldval)) == MODE_INT
+ if (oldval
+ && GET_MODE_CLASS (GET_MODE (oldval)) == MODE_INT
&& CONST_INT_P (newval))
{
/* Sanity check that we're replacing oldval with a CONST_INT
@@ -762,6 +763,34 @@
}
#define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE(&(INTO), (NEWVAL))
+
+#ifndef HAVE_cc0
+
+/* Similar to SUBST, but NEWVAL is a LOG_LINKS expression. */
+
+static void
+do_SUBST_LINK (rtx *into, rtx newval)
+{
+ struct undo *buf;
+ rtx oldval = *into;
+ if (oldval == newval)
+ return;
+
+ if (undobuf.frees)
+ buf = undobuf.frees, undobuf.frees = buf->next;
+ else
+ buf = XNEW (struct undo);
+
+ buf->kind = UNDO_LINKS;
+ buf->where.r = into;
+ buf->old_contents.r = oldval;
+ *into = newval;
+
+ buf->next = undobuf.undos, undobuf.undos = buf;
+}
+
+#define SUBST_LINK(oldval, newval) do_SUBST_LINK (&oldval, newval)
+#endif
\f
/* Subroutine of try_combine. Determine whether the combine replacement
patterns NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to
@@ -2871,6 +2900,7 @@
SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0));
SUBST (XEXP (SET_SRC (PATTERN (i2)), 0),
SET_DEST (PATTERN (i1)));
+ SUBST_LINK (LOG_LINKS (i2), alloc_INSN_LIST (i1, LOG_LINKS (i2)));
}
}
#endif
@@ -4474,6 +4504,11 @@
case UNDO_MODE:
adjust_reg_mode (*undo->where.r, undo->old_contents.m);
break;
+
+ case UNDO_LINKS:
+ *undo->where.r = undo->old_contents.r;
+ break;
+
default:
gcc_unreachable ();
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-04 15:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 14:54 [Patch 4.6 only] Fix PR48308 Ramana Radhakrishnan
2013-04-04 14:59 ` Jakub Jelinek
2013-04-04 19:50 ` Ramana Radhakrishnan
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).