Patchwork Testcase for PR37997

login
register
mail settings
Submitter Richard Guenther
Date Jan. 19, 2012, 9:36 a.m.
Message ID <alpine.LNX.2.00.1201191035370.4999@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/136796/
State New
Headers show

Comments

Richard Guenther - Jan. 19, 2012, 9:36 a.m.
... which is confused about a useful testcase not using uninitialized
variables.

Testcase committed.

Richard.

2012-01-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37997
	* gcc.dg/tree-ssa/ssa-pre-28.c: New testcase.

Patch

Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-28.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-28.c	(revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-28.c	(revision 0)
@@ -0,0 +1,21 @@ 
+/* PR37997 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre-details" } */
+
+int foo (int i, int b, int result)
+{
+  int mask;
+  if (b)
+    mask = -1;
+  else
+    mask = 0;
+  result = i + 1;
+  result = result & mask;
+  return result;
+}
+
+/* We should insert i + 1 into the if (b) path as well as the simplified
+   i + 1 & -1 expression.  And do replacement with two PHI temps.  */
+
+/* { dg-final { scan-tree-dump-times "with prephitmp" 2 "pre" } } */
+/* { dg-final { cleanup-tree-dump "pre" } } */