[PATCH] Fix PR86159

Richard Biener rguenther@suse.de
Fri Jun 15 08:18:00 GMT 2018


I am testing the following patch removing sign-conversion stripping
from gimplify_build* (those should vanish anyways...).

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

Richard.

2018-06-15  Richard Biener  <rguenther@suse.de>

	PR middle-end/86159
	* tree-cfg.c (gimplify_build3): Do not strip sign conversions,
	leave useless conversion stripping to force_gimple_operand_gsi.
	(gimplify_build2): Likewise.
	(gimplify_build1): Likewise.

	* g++.dg/pr86159.C: New testcase.

Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c	(revision 261584)
+++ gcc/tree-cfg.c	(working copy)
@@ -8967,8 +8967,6 @@ gimplify_build3 (gimple_stmt_iterator *g
   location_t loc = gimple_location (gsi_stmt (*gsi));
 
   ret = fold_build3_loc (loc, code, type, a, b, c);
-  STRIP_NOPS (ret);
-
   return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
                                    GSI_SAME_STMT);
 }
@@ -8983,8 +8981,6 @@ gimplify_build2 (gimple_stmt_iterator *g
   tree ret;
 
   ret = fold_build2_loc (gimple_location (gsi_stmt (*gsi)), code, type, a, b);
-  STRIP_NOPS (ret);
-
   return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
                                    GSI_SAME_STMT);
 }
@@ -8999,8 +8995,6 @@ gimplify_build1 (gimple_stmt_iterator *g
   tree ret;
 
   ret = fold_build1_loc (gimple_location (gsi_stmt (*gsi)), code, type, a);
-  STRIP_NOPS (ret);
-
   return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
                                    GSI_SAME_STMT);
 }
Index: gcc/testsuite/g++.dg/pr86159.C
===================================================================
--- gcc/testsuite/g++.dg/pr86159.C	(nonexistent)
+++ gcc/testsuite/g++.dg/pr86159.C	(working copy)
@@ -0,0 +1,10 @@
+// { dg-do compile }
+// { dg-options "-O -w -Wno-psabi" }
+
+typedef int vec __attribute__((vector_size(32)));
+vec fn1()
+{
+  vec x, zero{};
+  vec one = zero + 1;
+  return x < zero ? one : zero;
+}



More information about the Gcc-patches mailing list