public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto][patch] remove local variables from types (after gimplification)
@ 2008-06-23 14:48 Rafael Espindola
  2008-06-23 15:27 ` Diego Novillo
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Rafael Espindola @ 2008-06-23 14:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Guenther, Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

Richard pointed out that changing a pointer to VLA into a normal
pointer would introduce performance regressions on the lto branch.

Since the memref branch is going to clean things up on this area and
we have to move forward on lto, Diego and I agreed it would be better
to just patch the types before LTO.

Is the attached patch OK for LTO? I know there will be other places
that expect these fields to be non-NULL, but we can fix them as they
are hit.

Bootstraping and regression testing it now.

2008-06-23  Rafael Espindola  <espindola@google.com>

	* calls.c (must_pass_in_stack_var_size): handle a NULL TYPE_SIZE.
	* expr.c (store_field): handle a NULL TYPE_SIZE.
	* tree.c (reset_type_lang_specific): set TYPE_SIZE_UNIT,
	TYPE_SIZE and TYPE_MAX_VALUE to NULL_TREE if they are not INTEGER_CST.

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047

[-- Attachment #2: vla.patch --]
[-- Type: application/octet-stream, Size: 1861 bytes --]

diff --git a/gcc/calls.c b/gcc/calls.c
index e7799f0..022bdaf 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -4301,11 +4301,13 @@ must_pass_in_stack_var_size (enum machine_mode mode ATTRIBUTE_UNUSED,
 bool
 must_pass_in_stack_var_size_or_pad (enum machine_mode mode, const_tree type)
 {
+  tree size;
   if (!type)
     return false;
 
+  size = TYPE_SIZE (type);
   /* If the type has variable size...  */
-  if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+  if (!size || TREE_CODE (size) != INTEGER_CST)
     return true;
 
   /* If the type is marked as addressable (it is required
diff --git a/gcc/expr.c b/gcc/expr.c
index e2693d8..6898530 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5752,6 +5752,7 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
 	 RHS isn't the same size as the bitfield, we must use bitfield
 	 operations.  */
       || (bitsize >= 0
+	  && TYPE_SIZE (TREE_TYPE (exp))
 	  && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) == INTEGER_CST
 	  && compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), bitsize) != 0))
     {
diff --git a/gcc/tree.c b/gcc/tree.c
index dbf657b..79bff67 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3783,6 +3783,26 @@ reset_type_lang_specific (void **slot, void *unused ATTRIBUTE_UNUSED)
 {
   tree decl = *(tree*)slot;
   lang_hooks.reset_lang_specifics (decl);
+
+  if (TREE_CODE (decl) == ARRAY_TYPE)
+    {
+      tree unit_size = TYPE_SIZE_UNIT (decl);
+      tree size = TYPE_SIZE (decl);
+
+      if (unit_size && TREE_CODE (unit_size) != INTEGER_CST)
+	TYPE_SIZE_UNIT (decl) = NULL_TREE;
+
+      if (size && TREE_CODE (size) != INTEGER_CST)
+	TYPE_SIZE (decl) = NULL_TREE;
+    }
+
+  if (TREE_CODE (decl) == INTEGER_TYPE)
+    {
+      tree max = TYPE_MAX_VALUE (decl);
+      if (max && TREE_CODE (max) != INTEGER_CST)
+	TYPE_MAX_VALUE (decl) = NULL_TREE;
+    }
+
   return 1;
 }
 

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

end of thread, other threads:[~2008-07-02 20:51 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-23 14:48 [lto][patch] remove local variables from types (after gimplification) Rafael Espindola
2008-06-23 15:27 ` Diego Novillo
2008-06-24  9:32 ` Richard Guenther
2008-06-24 13:18   ` Rafael Espindola
2008-06-24 13:44     ` Richard Guenther
2008-06-24 20:38       ` Rafael Espindola
2008-06-24 20:44         ` Richard Guenther
2008-06-24 20:49           ` Rafael Espindola
2008-06-24 20:56             ` Richard Guenther
2008-06-25 21:13         ` Bill Maddox
2008-06-25 21:19           ` Rafael Espindola
2008-06-25 21:39             ` Richard Guenther
2008-06-25 23:33             ` Bill Maddox
2008-06-26  9:53               ` Richard Guenther
2008-06-26 14:53                 ` Rafael Espindola
2008-06-26 15:13                   ` Richard Guenther
2008-06-26 16:14               ` Rafael Espindola
2008-06-26 17:48                 ` Diego Novillo
2008-06-26 18:36                   ` Rafael Espindola
2008-06-26 14:26             ` Rafael Espindola
2008-06-26 18:14               ` Rafael Espindola
2008-07-02 20:58 ` Bill Maddox

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