public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dnovillo at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/12688] [tree-ssa] ICE building tcl
Date: Tue, 21 Oct 2003 02:38:00 -0000	[thread overview]
Message-ID: <20031021023515.27065.qmail@sources.redhat.com> (raw)
In-Reply-To: <20031020143540.12688.green@redhat.com>

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From dnovillo at redhat dot com  2003-10-21 02:35 -------
Subject: [tree-ssa] Fix folding statements into NOPs


When a statement like 'memcpy (T.241_91, (const char *)"", 0);' is
folded into 'T.241_91', we should replace the statement with a NOP
because it has no effect.

This fixes the PR and allows IA64 bootstraps to finish (only to die as
per http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12347 which I'll be
tackling next).


Diego.


	* tree-dfa.c (get_stmt_operands): Don't return early when dealing
	with an empty statement.
	* tree-ssa-ccp.c (set_rhs): If the expression has no side effects,
	replace the statement with an empty statement.

Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.173
diff -d -c -p -d -c -p -r1.1.4.173 tree-dfa.c
*** tree-dfa.c	18 Oct 2003 03:09:47 -0000	1.1.4.173
--- tree-dfa.c	21 Oct 2003 00:09:53 -0000
*************** get_stmt_operands (tree stmt)
*** 182,189 ****
      abort ();
  #endif
  
!   /* Ignore empty and error statements.  */
!   if (IS_EMPTY_STMT (stmt) || TREE_CODE (stmt) == ERROR_MARK)
      return;
  
    /* If the statement has not been modified, the operands are still valid.  */
--- 182,189 ----
      abort ();
  #endif
  
!   /* Ignore error statements.  */
!   if (TREE_CODE (stmt) == ERROR_MARK)
      return;
  
    /* If the statement has not been modified, the operands are still valid.  */
*************** get_stmt_operands (tree stmt)
*** 288,297 ****
      default:
        /* Notice that if get_expr_operands tries to use &STMT as the operand
  	 pointer (which may only happen for USE operands), we will abort in
! 	 add_use.  This default will handle statements like CALL_EXPRs or
! 	 VA_ARG_EXPRs that may appear on the RHS of a statement or as
! 	 statements themselves.  */
!       get_expr_operands (stmt, &stmt, opf_none, prev_vops);
        break;
      }
  
--- 288,298 ----
      default:
        /* Notice that if get_expr_operands tries to use &STMT as the operand
  	 pointer (which may only happen for USE operands), we will abort in
! 	 add_use.  This default will handle statements like empty statements,
! 	 CALL_EXPRs or VA_ARG_EXPRs that may appear on the RHS of a statement
! 	 or as statements themselves.  */
!       if (!IS_EMPTY_STMT (stmt))
! 	get_expr_operands (stmt, &stmt, opf_none, prev_vops);
        break;
      }
  
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.103
diff -d -c -p -d -c -p -r1.1.2.103 tree-ssa-ccp.c
*** tree-ssa-ccp.c	18 Oct 2003 03:09:47 -0000	1.1.2.103
--- tree-ssa-ccp.c	21 Oct 2003 00:09:53 -0000
*************** set_rhs (tree *stmt_p, tree expr)
*** 1750,1756 ****
    else
      {
        stmt_ann_t ann = stmt_ann (stmt);
!       *stmt_p = expr;
        (*stmt_p)->common.ann = (tree_ann) ann;
      }
  }
--- 1750,1764 ----
    else
      {
        stmt_ann_t ann = stmt_ann (stmt);
!       if (TREE_SIDE_EFFECTS (expr))
! 	*stmt_p = expr;
!       else
! 	{
! 	  /* If the expression is not a statement with side-effects, replace
! 	     the statement with a new empty statement.  */
! 	  *stmt_p = build_empty_stmt ();
! 	}
!      
        (*stmt_p)->common.ann = (tree_ann) ann;
      }
  }


  parent reply	other threads:[~2003-10-21  2:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-20 14:37 [Bug c/12688] New: " green at redhat dot com
2003-10-20 14:46 ` [Bug c/12688] " green at redhat dot com
2003-10-20 14:51 ` falk at debian dot org
2003-10-20 15:17 ` [Bug c/12688] [tree-ssa] " pinskia at gcc dot gnu dot org
2003-10-20 15:24 ` schwab at suse dot de
2003-10-20 15:40 ` [Bug optimization/12688] " pinskia at gcc dot gnu dot org
2003-10-20 16:36 ` dnovillo at redhat dot com
2003-10-20 16:44 ` dnovillo at gcc dot gnu dot org
2003-10-21  2:31 ` cvs-commit at gcc dot gnu dot org
2003-10-21  2:38 ` dnovillo at redhat dot com [this message]
2003-10-21  3:05 ` dnovillo 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=20031021023515.27065.qmail@sources.redhat.com \
    --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).