public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][3/4] Fix PR87118
@ 2018-08-28  8:37 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2018-08-28  8:37 UTC (permalink / raw)
  To: gcc-patches


For now give up on predicated values when doing PRE (there's a
similar hunk in PHI-translation already).  I need to sit down
and decide whether it's worth handling them or whether we'd
better prune them from the hash tables when assigning value-ids.

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

2018-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87117
	* tree-ssa-pre.c (compute_avail): Do not make expressions
	with predicated values available.
	(get_expr_value_id): Assert we do not run into predicated value
	expressions.

	* gcc.dg/pr87117-2.c: New testcase.

Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c	(revision 263906)
+++ gcc/tree-ssa-pre.c	(working copy)
@@ -663,6 +663,7 @@ get_expr_value_id (pre_expr expr)
       id = VN_INFO (PRE_EXPR_NAME (expr))->value_id;
       break;
     case NARY:
+      gcc_assert (!PRE_EXPR_NARY (expr)->predicated_values);
       id = PRE_EXPR_NARY (expr)->value_id;
       break;
     case REFERENCE:
@@ -3902,7 +3903,7 @@ compute_avail (void)
 			continue;
 
 		      vn_nary_op_lookup_stmt (stmt, &nary);
-		      if (!nary)
+		      if (!nary || nary->predicated_values)
 			continue;
 
 		      /* If the NARY traps and there was a preceding
Index: gcc/testsuite/gcc.dg/pr87117-2.c
===================================================================
--- gcc/testsuite/gcc.dg/pr87117-2.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr87117-2.c	(working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fcode-hoisting" } */
+
+void e();
+
+void a(int c, char **d)
+{
+  char b;
+  if (1 < c)
+    b = (char)(__INTPTR_TYPE__)d[0];
+  if (1 < c && b)
+    e();
+  while (1 < c)
+    ;
+}

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

only message in thread, other threads:[~2018-08-28  8:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28  8:37 [PATCH][3/4] Fix PR87118 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).