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]

[PATCH] Fix PR70499


The following patch fixes a SSA rewrite issue in 
gimple_regimplify_operands (some bigger rewrite is IMHO necessary
here or in the caller in this case, the inliner, but that's not
appropriate now or for branches).

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

Richard.

2016-04-05  Richard Biener  <rguenther@suse.de>

	PR middle-end/70499
	* gimplify-me.c (gimple_regimplify_operands): Do not rewrite
	non-register type temporaries into SSA.

	* g++.dg/torture/pr70499.C: New testcase.

Index: gcc/gimplify-me.c
===================================================================
*** gcc/gimplify-me.c	(revision 234705)
--- gcc/gimplify-me.c	(working copy)
*************** gimple_regimplify_operands (gimple *stmt
*** 299,305 ****
  	  if (need_temp)
  	    {
  	      tree temp = create_tmp_reg (TREE_TYPE (lhs));
! 	      if (gimple_in_ssa_p (cfun))
  		temp = make_ssa_name (temp);
  	      gimple_set_lhs (stmt, temp);
  	      post_stmt = gimple_build_assign (lhs, temp);
--- 299,306 ----
  	  if (need_temp)
  	    {
  	      tree temp = create_tmp_reg (TREE_TYPE (lhs));
! 	      if (gimple_in_ssa_p (cfun)
! 		  && is_gimple_reg_type (TREE_TYPE (lhs)))
  		temp = make_ssa_name (temp);
  	      gimple_set_lhs (stmt, temp);
  	      post_stmt = gimple_build_assign (lhs, temp);
Index: gcc/testsuite/g++.dg/torture/pr70499.C
===================================================================
*** gcc/testsuite/g++.dg/torture/pr70499.C	(revision 0)
--- gcc/testsuite/g++.dg/torture/pr70499.C	(working copy)
***************
*** 0 ****
--- 1,39 ----
+ // { dg-do compile }
+ // { dg-additional-options "-w -Wno-psabi" }
+ // { dg-additional-options "-mavx" { target x86_64-*-* i?86-*-* } }
+ 
+ typedef double __m256d __attribute__ ((__vector_size__ (32), __may_alias__));
+ 
+ struct SIMD {
+   __m256d data;
+   SIMD() {};
+   SIMD (double val) { }
+   SIMD(__m256d _data) { data = _data; }
+   SIMD operator* (SIMD a) { return a; }
+ };
+ 
+ struct Foo {
+   SIMD val;
+   SIMD dval[2];
+   __attribute__((__always_inline__)) SIMD & Value() throw() { return val; }
+   __attribute__((__always_inline__)) Foo operator* ( const Foo & y) throw() 
+     {
+       Foo res;
+       SIMD hx;
+       SIMD hy;
+       res.Value() = hx*hy;
+       res.dval[0] = hx*hy;
+       return res;
+     }
+ };
+ 
+ template<typename Tx>  
+ __attribute__((__always_inline__)) inline void inlineFunc(Tx hx[]) {
+     Tx x = hx[0], y = hx[1];
+     Tx lam[1] = (x*y);
+ }
+ 
+ void FooBarFunc () {
+   Foo adp[2];
+   inlineFunc (adp);
+ }


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