From: Jason Merrill Date: Fri, 2 Aug 2002 11:52:38 +0000 (-0400) Subject: semantics.c (expand_body): Do tree optimization in the function context, too. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=367aa58580632b0bef67f5bbcc41009eb8a09381;p=gcc.git semantics.c (expand_body): Do tree optimization in the function context, too. * semantics.c (expand_body): Do tree optimization in the function context, too. From-SVN: r55982 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 84b1a98acd2..f9e22ca2388 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-08-02 Jason Merrill + + * semantics.c (expand_body): Do tree optimization in the function + context, too. + 2002-08-01 Neil Booth * cp-tree.h: Move all warning and flag declarations to c-common.h. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 7098aae6c3e..58d1647cd68 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2326,6 +2326,7 @@ expand_body (fn) { int saved_lineno; const char *saved_input_filename; + tree saved_function; /* When the parser calls us after finishing the body of a template function, we don't really want to expand the body. When we're @@ -2403,21 +2404,23 @@ expand_body (fn) if (DECL_EXTERNAL (fn)) return; - timevar_push (TV_INTEGRATION); - - /* Optimize the body of the function before expanding it. */ - optimize_function (fn); - - timevar_pop (TV_INTEGRATION); - timevar_push (TV_EXPAND); - /* Save the current file name and line number. When we expand the body of the function, we'll set LINENO and INPUT_FILENAME so that error-mesages come out in the right places. */ saved_lineno = lineno; saved_input_filename = input_filename; + saved_function = current_function_decl; lineno = DECL_SOURCE_LINE (fn); input_filename = DECL_SOURCE_FILE (fn); + current_function_decl = fn; + + timevar_push (TV_INTEGRATION); + + /* Optimize the body of the function before expanding it. */ + optimize_function (fn); + + timevar_pop (TV_INTEGRATION); + timevar_push (TV_EXPAND); genrtl_start_function (fn); current_function_is_thunk = DECL_THUNK_P (fn); @@ -2450,6 +2453,7 @@ expand_body (fn) DECL_SAVED_TREE (fn) = NULL_TREE; /* And restore the current source position. */ + current_function_decl = saved_function; lineno = saved_lineno; input_filename = saved_input_filename; extract_interface_info ();