public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR56150
@ 2013-01-31  8:52 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2013-01-31  8:52 UTC (permalink / raw)
  To: gcc-patches


This fixes PR56150 - mixed store/loads are not equal.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2013-01-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/56150
	* tree-ssa-tail-merge.c (gimple_equal_p): Properly handle
	mixed store non-store stmts.

	* gcc.dg/torture/pr56150.c: New testcase.

Index: gcc/tree-ssa-tail-merge.c
===================================================================
*** gcc/tree-ssa-tail-merge.c	(revision 195574)
--- gcc/tree-ssa-tail-merge.c	(working copy)
*************** gimple_equal_p (same_succ same_succ, gim
*** 1119,1135 ****
      case GIMPLE_ASSIGN:
        lhs1 = gimple_get_lhs (s1);
        lhs2 = gimple_get_lhs (s2);
!       if (gimple_vdef (s1))
! 	{
! 	  if (vn_valueize (gimple_vdef (s1)) != vn_valueize (gimple_vdef (s2)))
! 	    return false;
! 	  if (TREE_CODE (lhs1) != SSA_NAME
! 	      && TREE_CODE (lhs2) != SSA_NAME)
! 	    return true;
! 	}
!       return (TREE_CODE (lhs1) == SSA_NAME
! 	      && TREE_CODE (lhs2) == SSA_NAME
! 	      && vn_valueize (lhs1) == vn_valueize (lhs2));
  
      case GIMPLE_COND:
        t1 = gimple_cond_lhs (s1);
--- 1119,1132 ----
      case GIMPLE_ASSIGN:
        lhs1 = gimple_get_lhs (s1);
        lhs2 = gimple_get_lhs (s2);
!       if (TREE_CODE (lhs1) != SSA_NAME
! 	  && TREE_CODE (lhs2) != SSA_NAME)
! 	return (vn_valueize (gimple_vdef (s1))
! 		== vn_valueize (gimple_vdef (s2)));
!       else if (TREE_CODE (lhs1) == SSA_NAME
! 	       && TREE_CODE (lhs2) == SSA_NAME)
! 	return vn_valueize (lhs1) == vn_valueize (lhs2);
!       return false;
  
      case GIMPLE_COND:
        t1 = gimple_cond_lhs (s1);
Index: gcc/testsuite/gcc.dg/torture/pr56150.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr56150.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr56150.c	(working copy)
***************
*** 0 ****
--- 1,17 ----
+ /* { dg-do compile } */
+ 
+ struct {
+     int f4;
+ } g1;
+ 
+ long g2;
+ 
+ volatile long g3;
+ 
+ void func_1 ()
+ {
+   if (g2)
+     g1 = g1;
+   else
+     g3;
+ }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-31  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-31  8:52 [PATCH] Fix PR56150 Richard Biener

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