summaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-22 09:14:04 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-22 09:14:04 +0000
commit6ed9f77061382aca1c5c4d8690dc1ac905c48253 (patch)
tree7df1c9f98b7f095c49e9697bdb59518dd553790d /gcc/tree-inline.c
parent7074f60d56bfc77cdb1e12c316c4448a292aec6a (diff)
downloadgcc-6ed9f77061382aca1c5c4d8690dc1ac905c48253.tar.gz
[PATCH tree-inline] Do not say "called from here" with UNKNOWN_LOCATION
In https://sourceware.org/ml/libc-alpha/2014-12/msg00300.html, we give a "called from here" note without actually having a location, which looks strange. I haven't been able to generate such a testcase. If this happens, try to at least point to the current function being called. If that location is also unknown, skip the extra note. gcc/ChangeLog: 2015-09-22 Manuel López-Ibáñez <manu@gcc.gnu.org> * tree-inline.c (expand_call_inline): Use inform for extra note. Do not give a note with UNKNOWN_LOCATION. Replace input_location with gimple_location (stmt). Use true/false instead of TRUE/FALSE. gcc/testsuite/ChangeLog: 2015-09-22 Manuel López-Ibáñez <manu@gcc.gnu.org> * gcc.target/i386/inline_error.c (int bar): Use dg-message for note. * gcc.target/i386/pr57756.c (static __inline int caller): Likewise. * gcc.target/i386/pr59789.c (f1): Likewise. * gcc.target/i386/intrinsics_5.c (__m128i foo): Likewise. * gcc.target/i386/intrinsics_6.c: Likewise. * gcc.dg/winline-5.c (int t): Likewise. * gcc.dg/winline-9.c (t): Likewise. * gcc.dg/always_inline2.c (q): Likewise. * gcc.dg/winline-2.c (inline int t): Likewise. * gcc.dg/winline-6.c: Likewise. * gcc.dg/winline-10.c (void g): Likewise. * gcc.dg/pr49243.c (void parse): Likewise. * gcc.dg/always_inline3.c (q2): Likewise. * gcc.dg/winline-3.c: Likewise. * gcc.dg/winline-7.c (inline void *t): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227997 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index abaea3f64d9..b7874668fb3 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4384,21 +4384,19 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
tree return_slot;
tree modify_dest;
tree return_bounds = NULL;
- location_t saved_location;
struct cgraph_edge *cg_edge;
cgraph_inline_failed_t reason;
basic_block return_block;
edge e;
gimple_stmt_iterator gsi, stmt_gsi;
- bool successfully_inlined = FALSE;
+ bool successfully_inlined = false;
bool purge_dead_abnormal_edges;
gcall *call_stmt;
unsigned int i;
- /* Set input_location here so we get the right instantiation context
- if we call instantiate_decl from inlinable_function_p. */
- /* FIXME: instantiate_decl isn't called by inlinable_function_p. */
- saved_location = input_location;
+ /* The gimplifier uses input_location in too many places, such as
+ internal_get_tmp_var (). */
+ location_t saved_location = input_location;
input_location = gimple_location (stmt);
/* From here on, we're only interested in CALL_EXPRs. */
@@ -4454,7 +4452,11 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
{
error ("inlining failed in call to always_inline %q+F: %s", fn,
cgraph_inline_failed_string (reason));
- error ("called from here");
+ if (gimple_location (stmt) != UNKNOWN_LOCATION)
+ inform (gimple_location (stmt), "called from here");
+ else if (DECL_SOURCE_LOCATION (cfun->decl) != UNKNOWN_LOCATION)
+ inform (DECL_SOURCE_LOCATION (cfun->decl),
+ "called from this function");
}
else if (warn_inline
&& DECL_DECLARED_INLINE_P (fn)
@@ -4467,9 +4469,15 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
/* Avoid warnings during early inline pass. */
&& symtab->global_info_ready)
{
- warning (OPT_Winline, "inlining failed in call to %q+F: %s",
- fn, _(cgraph_inline_failed_string (reason)));
- warning (OPT_Winline, "called from here");
+ if (warning (OPT_Winline, "inlining failed in call to %q+F: %s",
+ fn, _(cgraph_inline_failed_string (reason))))
+ {
+ if (gimple_location (stmt) != UNKNOWN_LOCATION)
+ inform (gimple_location (stmt), "called from here");
+ else if (DECL_SOURCE_LOCATION (cfun->decl) != UNKNOWN_LOCATION)
+ inform (DECL_SOURCE_LOCATION (cfun->decl),
+ "called from this function");
+ }
}
goto egress;
}
@@ -4534,7 +4542,8 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
{
id->block = make_node (BLOCK);
BLOCK_ABSTRACT_ORIGIN (id->block) = fn;
- BLOCK_SOURCE_LOCATION (id->block) = LOCATION_LOCUS (input_location);
+ BLOCK_SOURCE_LOCATION (id->block)
+ = LOCATION_LOCUS (gimple_location (stmt));
prepend_lexical_block (gimple_block (stmt), id->block);
}
@@ -4799,7 +4808,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
cg_edge->callee->remove ();
id->block = NULL_TREE;
- successfully_inlined = TRUE;
+ successfully_inlined = true;
egress:
input_location = saved_location;