public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: PR tree-optimization/35494: [4.4 Regression]: Revision  132991 breaks 483.xalancbmk
@ 2008-03-07 15:00 H.J. Lu
  2008-03-07 15:19 ` Richard Guenther
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: H.J. Lu @ 2008-03-07 15:00 UTC (permalink / raw)
  To: gcc-patches

We can't fold glocal variables with NULL DECL_INITIAL. I am testing it
on Linux/x86 and Linux/Intel64 as well as 483.xalancbmk. OK to install
if all pass?


H.J.
----
gcc/testsuite/

2008-03-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR tree-optimization/35494
	* g++.dg/tree-ssa/ssa-store-ccp-1.C: New.
	* gcc.dg/tree-ssa/ssa-store-ccp-2.c: Likewise.

gcc/

2008-03-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR tree-optimization/35494
	* tree-ssa-ccp.c (get_symbol_constant_value): Only fold local
	variables with NULL DECL_INITIAL.

--- gcc/testsuite/g++.dg/tree-ssa/ssa-store-ccp-1.C.local	2008-03-07 06:45:42.000000000 -0800
+++ gcc/testsuite/g++.dg/tree-ssa/ssa-store-ccp-1.C	2008-03-07 06:44:53.000000000 -0800
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+class bar
+{
+public:
+  static const int conststaticvariable;
+};
+
+
+int f(void)
+{
+  return bar::conststaticvariable;
+}
+
+/* There should be a reference to conststaticvariable since it is
+   global.  */
+/* { dg-final { scan-tree-dump-times "conststaticvariable" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-2.c.local	2008-03-07 06:58:07.000000000 -0800
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-2.c	2008-03-07 06:58:38.000000000 -0800
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+const int conststaticvariable;
+
+int f(void)
+{
+  return conststaticvariable;
+}
+
+/* There should be 1 reference to conststaticvariable since it is
+   global.  */
+/* { dg-final { scan-tree-dump-times "conststaticvariable" 1 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
--- gcc/tree-ssa-ccp.c.local	2008-03-06 14:18:27.000000000 -0800
+++ gcc/tree-ssa-ccp.c	2008-03-07 06:21:57.000000000 -0800
@@ -306,9 +306,10 @@ get_symbol_constant_value (tree sym)
       if (val
 	  && ccp_decl_initial_min_invariant (val))
 	return val;
-      /* Variables declared 'const' without an initializer
+      /* Local variables declared 'const' without an initializer
 	 have zero as the intializer.  */
       if (!val
+	  && !TREE_PUBLIC (sym)
           && (INTEGRAL_TYPE_P (TREE_TYPE (sym))
 	       || SCALAR_FLOAT_TYPE_P (TREE_TYPE (sym))))
         return fold_convert (TREE_TYPE (sym), integer_zero_node);

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-03-09 15:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-07 15:00 PATCH: PR tree-optimization/35494: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk H.J. Lu
2008-03-07 15:19 ` Richard Guenther
2008-03-07 15:30   ` H.J. Lu
2008-03-07 15:40     ` Richard Guenther
2008-03-09 14:43   ` H.J. Lu
2008-03-09 15:47     ` H.J. Lu
2008-03-07 16:39 ` Andrew Pinski
2008-03-07 17:00 ` Andrew Pinski
2008-03-07 19:11   ` H.J. Lu
2008-03-07 22:07     ` H.J. Lu
2008-03-08 20:44       ` Richard Guenther
2008-03-08 23:16         ` H.J. Lu
2008-03-08 23:32           ` Andrew Pinski
2008-03-08 23:47             ` H.J. Lu
2008-03-09  0:12               ` H.J. Lu
2008-03-09  5:31                 ` H.J. Lu

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