public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH] Fix -Og and TER
Date: Thu, 07 Mar 2013 15:52:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1303071650550.3543@zhemvz.fhfr.qr> (raw)


We need to avoid line-jumps due to TER, like we do for -O0.
This also adjust things to match the 4.8 changes for location
encodings (and the older PHI argument locations).

Bootstrap & regtest pending on x86_64-unknown-linux-gnu.

Does this look ok?

Thanks,
Richard.

2013-03-07  Richard Biener  <rguenther@suse.de>

	* tree-ssa-ter.c (is_replaceable_p): Do not TER across location
	or block changes with -Og.  Fix for location / block encoding
	changes and PHI arguments with locations.

Index: gcc/tree-ssa-ter.c
===================================================================
*** gcc/tree-ssa-ter.c	(revision 196520)
--- gcc/tree-ssa-ter.c	(working copy)
*************** is_replaceable_p (gimple stmt, bool ter)
*** 399,420 ****
      return false;
  
    locus1 = gimple_location (stmt);
!   block1 = gimple_block (stmt);
  
    if (gimple_code (use_stmt) == GIMPLE_PHI)
!     {
!       locus2 = 0;
!       block2 = NULL_TREE;
!     }
    else
!     {
!       locus2 = gimple_location (use_stmt);
!       block2 = gimple_block (use_stmt);
!     }
  
!   if (!optimize
        && ter
!       && ((locus1 && locus1 != locus2) || (block1 && block1 != block2)))
      return false;
  
    /* Used in this block, but at the TOP of the block, not the end.  */
--- 400,421 ----
      return false;
  
    locus1 = gimple_location (stmt);
!   block1 = LOCATION_BLOCK (locus1);
!   locus1 = LOCATION_LOCUS (locus1);
  
    if (gimple_code (use_stmt) == GIMPLE_PHI)
!     locus2 = gimple_phi_arg_location (use_stmt, PHI_ARG_INDEX_FROM_USE (use_p));
    else
!     locus2 = gimple_location (use_stmt);
!   block2 = LOCATION_BLOCK (locus2);
!   locus2 = LOCATION_LOCUS (locus2);
  
!   if ((!optimize || optimize_debug)
        && ter
!       && ((locus1 != UNKNOWN_LOCATION
! 	   && locus1 != locus2)
! 	  || (block1 != NULL_TREE
! 	      && block1 != block2)))
      return false;
  
    /* Used in this block, but at the TOP of the block, not the end.  */

             reply	other threads:[~2013-03-07 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 15:52 Richard Biener [this message]
2013-03-07 16:16 ` Jakub Jelinek

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=alpine.LNX.2.00.1303071650550.3543@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /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).