This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix latent bug in cfg_remove_useless_stmts_bb


Jeff Law and I discussed this a couple of weeks ago.  This is a latent
bug in the current tree, but some other change of mine triggered it
and caused a regression in c-torture/execute/930513-2.c with -O3.

2004-08-31  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
	    Jeff Law  <law@redhat.com>

	* tree-cfg.c (cfg_remove_useless_stmts_bb): Also invalidate if VAL
	gets modified.

*** tree-cfg.c	25 Aug 2004 21:21:12 -0000	2.43
--- tree-cfg.c	29 Aug 2004 21:33:00 -0000
*************** cfg_remove_useless_stmts_bb (basic_block
*** 1739,1746 ****
  	}
  
!       /* Invalidate the var if we encounter something that could modify it.  */
        if (TREE_CODE (stmt) == ASM_EXPR
  	  || (TREE_CODE (stmt) == MODIFY_EXPR
! 	      && TREE_OPERAND (stmt, 0) == var))
  	return;
    
--- 1739,1750 ----
  	}
  
!       /* Invalidate the var if we encounter something that could modify it.
! 	 Likewise for the value it was previously set to.  Note that we only
! 	 consider values that are either a VAR_DECL or PARM_DECL so we
! 	 can test for conflict very simply.  */
        if (TREE_CODE (stmt) == ASM_EXPR
  	  || (TREE_CODE (stmt) == MODIFY_EXPR
! 	      && (TREE_OPERAND (stmt, 0) == var
! 		  || TREE_OPERAND (stmt, 0) == val)))
  	return;
    


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]