OSDN Git Service

* gcc.dg/lto/ipacp_0.c: New test.
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 May 2010 14:37:30 +0000 (14:37 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 May 2010 14:37:30 +0000 (14:37 +0000)
* gcc.dg/lto/ipacp_1.c: New test.

* opts.c (decode_options): Do not disable whopr at ipa_cp.
* ipa-prop.c (ipa_detect_param_modifications): Walk PHI nodes too.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159535 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/ipa-prop.c
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/ipacp_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/ipacp_1.c [new file with mode: 0644]

index cc7419b..4519c0a 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-18  Jan Hubicka  <jh@suse.cz>
+
+       * opts.c (decode_options): Do not disable whopr at ipa_cp.
+       * ipa-prop.c (ipa_detect_param_modifications): Walk PHI nodes too.
+
 2010-05-18  Steven Bosscher  <steven@gcc.gnu.org>
 
        PR lto/44184
index bd29d24..6afc713 100644 (file)
@@ -7456,8 +7456,6 @@ that otherwise would not fit in memory.  This option enables
 
 Disabled by default.
 
-This option is experimental.
-
 @item -fwpa
 @opindex fwpa
 This is an internal option used by GCC when compiling with
index 113a008..6437389 100644 (file)
@@ -269,11 +269,18 @@ ipa_detect_param_modifications (struct cgraph_node *node)
 
   func = DECL_STRUCT_FUNCTION (decl);
   FOR_EACH_BB_FN (bb, func)
-    for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-      walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info,
-                                    visit_load_for_mod_analysis,
-                                    visit_store_addr_for_mod_analysis,
-                                    visit_store_addr_for_mod_analysis);
+    {
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+       walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info,
+                                      visit_load_for_mod_analysis,
+                                      visit_store_addr_for_mod_analysis,
+                                      visit_store_addr_for_mod_analysis);
+      for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))
+       walk_stmt_load_store_addr_ops (gsi_stmt (gsi), info,
+                                      visit_load_for_mod_analysis,
+                                      visit_store_addr_for_mod_analysis,
+                                      visit_store_addr_for_mod_analysis);
+    }
 
   info->modification_analysis_done = 1;
 }
index 14c9b04..d5a9fb3 100644 (file)
@@ -1150,7 +1150,6 @@ decode_options (unsigned int argc, const char **argv)
   if (flag_wpa || flag_ltrans)
     {
       /* These passes are not WHOPR compatible yet.  */
-      flag_ipa_cp = 0;
       flag_ipa_pta = 0;
       flag_ipa_struct_reorg = 0;
     }
index 609f84b..15200cd 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-18  Jan Hubicka  <jh@suse.cz>
+
+       * gcc.dg/lto/ipacp_0.c: New test.
+       * gcc.dg/lto/ipacp_1.c: New test.
+
 2010-05-18  Steven Bosscher  <steven@gcc.gnu.org>
 
        PR lto/44184
diff --git a/gcc/testsuite/gcc.dg/lto/ipacp_0.c b/gcc/testsuite/gcc.dg/lto/ipacp_0.c
new file mode 100644 (file)
index 0000000..3212261
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-lto-options {{ -O1 -fwhopr -fipa-cp -fipa-cp-clone}} } */
+/* { dg-lto-do run } */
+
+/* Test that clonning happens and we unify declarations of a from both units.  */
+const int a = 5;
+extern void clone_me (int *);
+
+int
+main(void)
+{
+  int i;
+  for (i=0;i<100;i++)
+   clone_me ((int *)&a);
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/ipacp_1.c b/gcc/testsuite/gcc.dg/lto/ipacp_1.c
new file mode 100644 (file)
index 0000000..69c1ec6
--- /dev/null
@@ -0,0 +1,12 @@
+void abort (void);
+extern int a;
+
+__attribute__ ((noinline))
+void
+clone_me (int *ptr)
+{
+  if (ptr != &a)
+    abort ();
+  if (!__builtin_constant_p (ptr != &a))
+    abort ();
+}