This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Stay in GIMPLE when inlining
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Fri, 13 May 2005 01:56:33 +0200
- Subject: Stay in GIMPLE when inlining
Hi,
this patch makes inliner to stay gimple so we don't need to re-gimplify after inlining.
Bootstrapped/regtested i686-pc-gnu-linux, saves few seconds of compile time and some memory too.
Honza
2005-05-13 Jan Hubicka <jh@suse.cz>
* tree-inline.c (copy_body_r): Simplify substituted ADDR_EXPRs.
* tree-optimize.c (pass_gimple): Kill.
(init_tree_optimization_passes): Kill pass_gimple.
(tree_rest_of_compilation): Do verify_stmts to check that we are gimple.
* pr15791-?.C: Replace gimple by lower dump.
* pr15791-?.c: Replace gimple by lower dump.
buidins-47.c: Likewise.
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.182
diff -c -3 -p -r1.182 tree-inline.c
*** tree-inline.c 23 Apr 2005 21:27:58 -0000 1.182
--- tree-inline.c 12 May 2005 23:50:13 -0000
*************** copy_body_r (tree *tp, int *walk_subtree
*** 566,586 ****
{
/* Get rid of *& from inline substitutions that can happen when a
pointer argument is an ADDR_EXPR. */
! tree decl = TREE_OPERAND (*tp, 0), value;
splay_tree_node n;
n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl);
if (n)
{
! value = (tree) n->value;
! STRIP_NOPS (value);
! if (TREE_CODE (value) == ADDR_EXPR
! && (lang_hooks.types_compatible_p
! (TREE_TYPE (*tp), TREE_TYPE (TREE_OPERAND (value, 0)))))
! {
! *tp = TREE_OPERAND (value, 0);
! return copy_body_r (tp, walk_subtrees, data);
! }
}
}
--- 566,580 ----
{
/* Get rid of *& from inline substitutions that can happen when a
pointer argument is an ADDR_EXPR. */
! tree decl = TREE_OPERAND (*tp, 0);
splay_tree_node n;
n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl);
if (n)
{
! *tp = build_fold_indirect_ref ((tree)n->value);
! *walk_subtrees = 0;
! return NULL;
}
}
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.91
diff -c -3 -p -r2.91 tree-optimize.c
*** tree-optimize.c 12 May 2005 19:29:21 -0000 2.91
--- tree-optimize.c 12 May 2005 23:50:13 -0000
*************** bool in_gimple_form;
*** 57,81 ****
/* The root of the compilation pass tree, once constructed. */
static struct tree_opt_pass *all_passes, *all_ipa_passes;
- /* Pass: dump the gimplified, inlined, functions. */
-
- static struct tree_opt_pass pass_gimple =
- {
- "gimple", /* name */
- NULL, /* gate */
- NULL, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- 0, /* tv_id */
- 0, /* properties_required */
- PROP_gimple_any, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_dump_func, /* todo_flags_finish */
- 0 /* letter */
- };
-
/* Gate: execute, or not, all of the non-trivial optimizations. */
static bool
--- 57,62 ----
*************** init_tree_optimization_passes (void)
*** 340,346 ****
*p = NULL;
p = &all_passes;
- NEXT_PASS (pass_gimple);
NEXT_PASS (pass_remove_useless_stmts);
NEXT_PASS (pass_mudflap_1);
NEXT_PASS (pass_lower_cf);
--- 321,326 ----
*************** tree_rest_of_compilation (tree fndecl)
*** 730,735 ****
--- 710,719 ----
/* Initialize the default bitmap obstack. */
bitmap_obstack_initialize (NULL);
bitmap_obstack_initialize (®_obstack); /* FIXME, only at RTL generation*/
+
+ #ifdef ENABLE_CHECING
+ verify_stmts ();
+ #endif
/* Perform all tree transforms and optimizations. */
execute_pass_list (all_passes);
Index: testsuite/g++.dg/tree-ssa/pr15791-3.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/tree-ssa/pr15791-3.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 pr15791-3.C
*** testsuite/g++.dg/tree-ssa/pr15791-3.C 31 Mar 2005 18:34:13 -0000 1.2
--- testsuite/g++.dg/tree-ssa/pr15791-3.C 12 May 2005 23:50:20 -0000
***************
*** 1,5 ****
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-gimple" } */
int f(int i, unsigned j)
{
--- 1,5 ----
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-lower" } */
int f(int i, unsigned j)
{
*************** int f(int i, unsigned j)
*** 9,13 ****
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "gimple" } } */
! /* { dg-final { cleanup-tree-dump "gimple" } } */
--- 9,13 ----
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "lower" } } */
! /* { dg-final { cleanup-tree-dump "lower" } } */
Index: testsuite/g++.dg/tree-ssa/pr15791-4.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/tree-ssa/pr15791-4.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 pr15791-4.C
*** testsuite/g++.dg/tree-ssa/pr15791-4.C 31 Mar 2005 18:34:13 -0000 1.2
--- testsuite/g++.dg/tree-ssa/pr15791-4.C 12 May 2005 23:50:20 -0000
***************
*** 1,5 ****
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-gimple" } */
int f(int i, int j)
{
--- 1,5 ----
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-lower" } */
int f(int i, int j)
{
*************** int f(int i, int j)
*** 9,13 ****
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "gimple" } } */
! /* { dg-final { cleanup-tree-dump "gimple" } } */
--- 9,13 ----
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "lower" } } */
! /* { dg-final { cleanup-tree-dump "lower" } } */
Index: testsuite/g++.dg/tree-ssa/pr15791-5.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/tree-ssa/pr15791-5.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 pr15791-5.C
*** testsuite/g++.dg/tree-ssa/pr15791-5.C 31 Mar 2005 18:34:13 -0000 1.2
--- testsuite/g++.dg/tree-ssa/pr15791-5.C 12 May 2005 23:50:20 -0000
***************
*** 1,5 ****
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-gimple" } */
int foo(int i, int j)
{
--- 1,5 ----
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-lower" } */
int foo(int i, int j)
{
*************** int foo(int i, int j)
*** 9,13 ****
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 1 "gimple" } } */
! /* { dg-final { cleanup-tree-dump "gimple" } } */
--- 9,13 ----
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 1 "lower" } } */
! /* { dg-final { cleanup-tree-dump "lower" } } */
Index: testsuite/gcc.dg/builtins-47.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/builtins-47.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 builtins-47.c
*** testsuite/gcc.dg/builtins-47.c 31 Mar 2005 18:34:14 -0000 1.3
--- testsuite/gcc.dg/builtins-47.c 12 May 2005 23:50:22 -0000
***************
*** 1,5 ****
/* { dg-do run } */
! /* { dg-options "-ffast-math -fdump-tree-gimple" } */
extern double sqrt (double);
extern double pow (double, double);
--- 1,5 ----
/* { dg-do run } */
! /* { dg-options "-ffast-math -fdump-tree-lower" } */
extern double sqrt (double);
extern double pow (double, double);
*************** int main ()
*** 15,20 ****
return 0;
}
! /* { dg-final { scan-tree-dump-times "sqrt" 0 "gimple" } } */
! /* { dg-final { scan-tree-dump-times "pow" 0 "gimple" } } */
! /* { dg-final { cleanup-tree-dump "gimple" } } */
--- 15,20 ----
return 0;
}
! /* { dg-final { scan-tree-dump-times "sqrt" 0 "lower" } } */
! /* { dg-final { scan-tree-dump-times "pow" 0 "lower" } } */
! /* { dg-final { cleanup-tree-dump "lower" } } */
Index: testsuite/gcc.dg/tree-ssa/pr15791-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr15791-3.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 pr15791-3.c
*** testsuite/gcc.dg/tree-ssa/pr15791-3.c 31 Mar 2005 18:34:15 -0000 1.2
--- testsuite/gcc.dg/tree-ssa/pr15791-3.c 12 May 2005 23:50:22 -0000
***************
*** 1,5 ****
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-gimple" } */
int f(int i, unsigned j)
{
--- 1,5 ----
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-lower" } */
int f(int i, unsigned j)
{
*************** int f(int i, unsigned j)
*** 9,13 ****
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "gimple" } } */
! /* { dg-final { cleanup-tree-dump "gimple" } } */
--- 9,13 ----
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "lower" } } */
! /* { dg-final { cleanup-tree-dump "lower" } } */
Index: testsuite/gcc.dg/tree-ssa/pr15791-4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr15791-4.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 pr15791-4.c
*** testsuite/gcc.dg/tree-ssa/pr15791-4.c 31 Mar 2005 18:34:15 -0000 1.2
--- testsuite/gcc.dg/tree-ssa/pr15791-4.c 12 May 2005 23:50:22 -0000
***************
*** 1,5 ****
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-gimple" } */
int f(int i, int j)
{
--- 1,5 ----
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-lower" } */
int f(int i, int j)
{
*************** int f(int i, int j)
*** 9,13 ****
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "gimple" } } */
! /* { dg-final { cleanup-tree-dump "gimple" } } */
--- 9,13 ----
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 0 "lower" } } */
! /* { dg-final { cleanup-tree-dump "lower" } } */
Index: testsuite/gcc.dg/tree-ssa/pr15791-5.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/tree-ssa/pr15791-5.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 pr15791-5.c
*** testsuite/gcc.dg/tree-ssa/pr15791-5.c 31 Mar 2005 18:34:15 -0000 1.2
--- testsuite/gcc.dg/tree-ssa/pr15791-5.c 12 May 2005 23:50:22 -0000
***************
*** 1,5 ****
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-gimple" } */
int foo(int i, int j)
{
--- 1,5 ----
/* { dg-do compile } */
! /* { dg-options "-fdump-tree-lower" } */
int foo(int i, int j)
{
*************** int foo(int i, int j)
*** 9,13 ****
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 1 "gimple" } } */
! /* { dg-final { cleanup-tree-dump "gimple" } } */
--- 9,13 ----
return 0;
}
! /* { dg-final { scan-tree-dump-times "i == j" 1 "lower" } } */
! /* { dg-final { cleanup-tree-dump "lower" } } */