public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/65791] New: Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size
@ 2015-04-17  9:56 vries at gcc dot gnu.org
  2015-04-17 10:03 ` [Bug tree-optimization/65791] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2015-04-17  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65791
           Summary: Postpone expand_ifn_va_arg till after
                    optimize_va_list_gpr_fpr_size
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org

After the fix for PR64950 - postpone expanding va_arg till pass_stdarg, there's
this TODO pass_stdarg::execute:
...
unsigned int
pass_stdarg::execute (function *fun)
{
  /* TODO: Postpone expand_ifn_va_arg till after
     optimize_va_list_gpr_fpr_size.  */
  expand_ifn_va_arg (fun);

  if (flag_stdarg_opt
      /* This optimization is only for stdarg functions.  */
      && fun->stdarg != 0)
    optimize_va_list_gpr_fpr_size (fun);

  return 0;
}
...

Essentially, we want to rewrite optimize_va_list_gpr_fpr_size to work on
ifn_va_arg.


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

* [Bug tree-optimization/65791] Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size
  2015-04-17  9:56 [Bug tree-optimization/65791] New: Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size vries at gcc dot gnu.org
@ 2015-04-17 10:03 ` vries at gcc dot gnu.org
  2015-04-29  9:41 ` vries at gcc dot gnu.org
  2015-05-11 11:15 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2015-04-17 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-17
     Ever confirmed|0                           |1

--- Comment #1 from vries at gcc dot gnu.org ---
https://gcc.gnu.org/ml/gcc/2015-02/msg00115.html :
...
> [ We're still expanding ifn_va_arg before the va_list_gpr/fpr_size
> optimization. ]

Yeah, and the point of the exercise was of course to change that ;)
...


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

* [Bug tree-optimization/65791] Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size
  2015-04-17  9:56 [Bug tree-optimization/65791] New: Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size vries at gcc dot gnu.org
  2015-04-17 10:03 ` [Bug tree-optimization/65791] " vries at gcc dot gnu.org
@ 2015-04-29  9:41 ` vries at gcc dot gnu.org
  2015-05-11 11:15 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2015-04-29  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from vries at gcc dot gnu.org ---
Hopefully, after implementing this todo we can revert this change in
tree-ssa/stdarg-2.c:
-
https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff;f=gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c;h=5a74280f7281814eff9cf221946744c0f6c8e43f;hp=fe39da3528059173c33f0a8930af9de9c02541f4;hb=82fc0e0a3a4f82770e7e076cab5309bb1bd9fe87;hpb=4036aeb0fb3b3765d257383b1a55af043c23988d


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

* [Bug tree-optimization/65791] Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size
  2015-04-17  9:56 [Bug tree-optimization/65791] New: Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size vries at gcc dot gnu.org
  2015-04-17 10:03 ` [Bug tree-optimization/65791] " vries at gcc dot gnu.org
  2015-04-29  9:41 ` vries at gcc dot gnu.org
@ 2015-05-11 11:15 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2015-05-11 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #3 from vries at gcc dot gnu.org ---
Is this the sort of thing we want? We use the hook to tell us what the offset
is (rather than to have to retrieve it ourselves) and use that in the
pass_stdarg optimization?

...
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7bd9ff3..6ca594db 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9033,7 +9033,7 @@ ix86_va_start (tree valist, rtx nextarg)

 static tree
 ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
-                     gimple_seq *post_p)
+                     gimple_seq *post_p, tree *gpr_offset_p, tree
*fpr_offset_p)
 {
   static const int intreg[6] = { 0, 1, 2, 3, 4, 5 };
   tree f_gpr, f_fpr, f_ovf, f_sav;
@@ -9269,15 +9269,19 @@ ix86_gimplify_va_arg (tree valist, tree type,
gimple_seq *pre_p,

       if (needed_intregs)
        {
-         t = build2 (PLUS_EXPR, TREE_TYPE (gpr), gpr,
-                     build_int_cst (TREE_TYPE (gpr), needed_intregs * 8));
+         tree gpr_offset = build_int_cst (TREE_TYPE (gpr), needed_intregs *
8);
+         if (gpr_offset_p)
+           *gpr_offset_p = gpr_offset;
+         t = build2 (PLUS_EXPR, TREE_TYPE (gpr), gpr, gpr_offset);
          gimplify_assign (gpr, t, pre_p);
        }

       if (needed_sseregs)
        {
-         t = build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr,
-                     build_int_cst (TREE_TYPE (fpr), needed_sseregs * 16));
+         tree fpr_offset = build_int_cst (TREE_TYPE (fpr), needed_sseregs *
16);
+         if (fpr_offset_p)
+           *fpr_offset_p = fpr_offset;
+         t = build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr, fpr_offset);
          gimplify_assign (fpr, t, pre_p);
        }

...


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

end of thread, other threads:[~2015-05-11 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-17  9:56 [Bug tree-optimization/65791] New: Postpone expand_ifn_va_arg till after optimize_va_list_gpr_fpr_size vries at gcc dot gnu.org
2015-04-17 10:03 ` [Bug tree-optimization/65791] " vries at gcc dot gnu.org
2015-04-29  9:41 ` vries at gcc dot gnu.org
2015-05-11 11:15 ` vries at gcc dot gnu.org

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).