public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dave at hiauly1 dot hia dot nrc dot ca" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/32296] [4.3 Regression] Bootstrap failure in stage1 on hppa*-*-*
Date: Fri, 15 Jun 2007 20:05:00 -0000	[thread overview]
Message-ID: <20070615200533.13997.qmail@sourceware.org> (raw)
In-Reply-To: <bug-32296-276@http.gcc.gnu.org/bugzilla/>



------- Comment #13 from dave at hiauly1 dot hia dot nrc dot ca  2007-06-15 20:05 -------
Subject: Re:  [4.3 Regression] Bootstrap failure in stage1 on hppa*-*-*

> > We need to know that the return pointer (r2) is not used and that
> > the function is a leaf function (i.e., that the incoming value in
> > r2 is unchanged).  Calls clobber r2.
> > 
> > Dave
> 
> Sounds like the following patch would work:
> 
> diff -r 149399c845b5 gcc/config/pa/pa.c
> --- a/gcc/config/pa/pa.c        Tue Jun 12 15:49:27 2007 -0700
> +++ b/gcc/config/pa/pa.c        Wed Jun 13 18:37:17 2007 -0700
> @@ -4415,7 +4415,7 @@ hppa_can_use_return_insn_p (void)
>  {
>    return (reload_completed
>           && (compute_frame_size (get_frame_size (), 0) ? 0 : 1)
> -         && df_hard_reg_used_count (2) == 1
> +         && DF_REG_DEF_COUNT (2) == 0
>           && ! frame_pointer_needed);
>  }
> 
> 
> This essentially checks if r2 is ever written within the function
> (including the calls since r2 is included in the CALL_USED_REGS).

Ok, I've found the problem.  The code that outputs trivial returns
in function.c has changed and just outputs the return when optimize
and HAVE_RETURN are true.  As a result, we are generating trivial
returns in cases when we shouldn't.

I think the solution is to rename the "return" pattern and let
the pa epilogue expander control the show.  This is what I currently
have:

Index: config/pa/pa.md
===================================================================
--- config/pa/pa.md     (revision 125747)
+++ config/pa/pa.md     (working copy)
@@ -7345,11 +7345,11 @@

 ;; This can only be used in a leaf function, so we do
 ;; not need to use the PIC register when generating PIC code.
-(define_insn "return"
+(define_insn "trivial_return"
   [(return)
    (use (reg:SI 2))
    (const_int 0)]
-  "hppa_can_use_return_insn_p ()"
+  ""
   "*
 {
   if (TARGET_PA_20)
@@ -7409,7 +7409,7 @@
   /* Try to use the trivial return first.  Else use the full
      epilogue.  */
   if (hppa_can_use_return_insn_p ())
-    emit_jump_insn (gen_return ());
+    emit_jump_insn (gen_trivial_return ());
   else
     {
       rtx x;
Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c      (revision 125747)
+++ config/pa/pa.c      (working copy)
@@ -47,6 +47,7 @@
 #include "tm_p.h"
 #include "target.h"
 #include "target-def.h"
+#include "df.h"

 /* Return nonzero if there is a bypass for the output of 
    OUT_INSN and the fp store IN_INSN.  */
@@ -4413,9 +4414,9 @@
 hppa_can_use_return_insn_p (void)
 {
   return (reload_completed
-         && (compute_frame_size (get_frame_size (), 0) ? 0 : 1)
-         && ! df_regs_ever_live_p (2)
-         && ! frame_pointer_needed);
+         && DF_REG_DEF_COUNT (2) == 0
+         && !frame_pointer_needed
+         && (compute_frame_size (get_frame_size (), 0) ? 0 : 1));
 }

 void

The code still seems to be generating trivial returns.  Full bootstrap
is in progress.

If this works, there's probably some minor cleanups that can be made.
hppa_can_use_return_insn_p() is only called by the epilogue expander
and it may be possible to move it there.  I also think we can do away
with one of trivial_return and return_internal in pa.md.

Dave


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32296


  parent reply	other threads:[~2007-06-15 20:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12  0:33 [Bug regression/32296] New: " danglin at gcc dot gnu dot org
2007-06-12  0:40 ` [Bug regression/32296] " pinskia at gcc dot gnu dot org
2007-06-12  0:44 ` [Bug rtl-optimization/32296] [4.3 Regression] " pinskia at gcc dot gnu dot org
2007-06-12  1:01 ` spark at gcc dot gnu dot org
2007-06-12  1:14 ` spark at gcc dot gnu dot org
2007-06-12  1:38 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-12 21:43 ` spark at gcc dot gnu dot org
2007-06-12 23:00 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-12 23:07 ` spark at gcc dot gnu dot org
2007-06-12 23:31 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-13  3:45 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-13  3:48 ` spark at gcc dot gnu dot org
2007-06-13 13:28 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-14  3:54 ` spark at gcc dot gnu dot org
2007-06-14 21:05 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-15 20:05 ` dave at hiauly1 dot hia dot nrc dot ca [this message]
2007-06-19 19:57 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-19 20:10 ` hjl at lucon dot org
2007-06-19 20:40 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-19 23:30 ` danglin at gcc dot gnu dot org
2007-06-19 23:32 ` danglin at gcc dot gnu dot org
2007-06-21  2:56 ` dave at hiauly1 dot hia dot nrc dot ca
2007-06-21  8:53 ` tbm at cyrius dot com
2007-06-29 18:44 ` mmitchel at gcc dot gnu dot org
2007-06-30 15:20 ` danglin at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070615200533.13997.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).