diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2015-09-22 09:14:04 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2015-09-22 09:14:04 +0000 |
commit | 9915b1c916b1e6aa0fb7aa738dcc217f5f69b8ef (patch) | |
tree | 7df1c9f98b7f095c49e9697bdb59518dd553790d /gcc | |
parent | 50b4b446bb3894b6b8a830554009bd9cbdb8009a (diff) | |
download | gcc-9915b1c916b1e6aa0fb7aa738dcc217f5f69b8ef.zip gcc-9915b1c916b1e6aa0fb7aa738dcc217f5f69b8ef.tar.gz gcc-9915b1c916b1e6aa0fb7aa738dcc217f5f69b8ef.tar.bz2 |
[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.
From-SVN: r227997
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/always_inline2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/always_inline3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr49243.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/winline-10.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/winline-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/winline-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/winline-5.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/winline-6.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/winline-7.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/winline-9.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/inline_error.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/intrinsics_5.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/intrinsics_6.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr57756.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr59789.c | 2 | ||||
-rw-r--r-- | gcc/tree-inline.c | 33 |
18 files changed, 61 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3dd8a1d..86b5c21 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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. + 2015-09-22 Tom de Vries <tom@codesourcery.com> PR tree-optimization/67666 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f5d39c..e5c415e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +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. + 2015-09-22 Tom de Vries <tom@codesourcery.com> PR tree-optimization/67666 diff --git a/gcc/testsuite/gcc.dg/always_inline2.c b/gcc/testsuite/gcc.dg/always_inline2.c index 297159b..89b439f 100644 --- a/gcc/testsuite/gcc.dg/always_inline2.c +++ b/gcc/testsuite/gcc.dg/always_inline2.c @@ -4,5 +4,5 @@ inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not ava void q(void) { - t(); /* { dg-error "called from here" } */ + t(); /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.dg/always_inline3.c b/gcc/testsuite/gcc.dg/always_inline3.c index 5d55e4d..1bd2b6d 100644 --- a/gcc/testsuite/gcc.dg/always_inline3.c +++ b/gcc/testsuite/gcc.dg/always_inline3.c @@ -6,6 +6,6 @@ q2(void) /* { dg-error "recursive inlining" } */ { if (do_something_evil ()) return; - q2(); /* { dg-error "called from here" } */ + q2(); /* { dg-message "called from here" } */ q2(); /* With -O2 we don't warn here, it is eliminated by tail recursion. */ } diff --git a/gcc/testsuite/gcc.dg/pr49243.c b/gcc/testsuite/gcc.dg/pr49243.c index f896b05..78ac226 100644 --- a/gcc/testsuite/gcc.dg/pr49243.c +++ b/gcc/testsuite/gcc.dg/pr49243.c @@ -20,6 +20,6 @@ static inline int wrapper(const char **s_ptr) /* { dg-warning "(inlining failed| void parse(const char *data) { const char *s = data; - if (!(wrapper(&s) == -1 && (s - data) == 1)) /* { dg-warning "called from here" } */ + if (!(wrapper(&s) == -1 && (s - data) == 1)) /* { dg-message "called from here" } */ __builtin_abort(); } diff --git a/gcc/testsuite/gcc.dg/winline-10.c b/gcc/testsuite/gcc.dg/winline-10.c index 2106253..b781bc6 100644 --- a/gcc/testsuite/gcc.dg/winline-10.c +++ b/gcc/testsuite/gcc.dg/winline-10.c @@ -11,7 +11,7 @@ inline void f (x) /* { dg-warning "inlining .* mismatched arg" "" } */ void g (struct s x) { - f (x); /* { dg-warning "called from here" "" } */ + f (x); /* { dg-message "called from here" } */ } void f (int x); /* { dg-warning "follows non-prototype definition" } */ diff --git a/gcc/testsuite/gcc.dg/winline-2.c b/gcc/testsuite/gcc.dg/winline-2.c index f47c38c..f4f7cc4 100644 --- a/gcc/testsuite/gcc.dg/winline-2.c +++ b/gcc/testsuite/gcc.dg/winline-2.c @@ -4,5 +4,5 @@ inline int q(void); /* { dg-warning "body not available" "" } */ inline int t(void) { - return q(); /* { dg-warning "called from here" "" } */ + return q(); /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.dg/winline-3.c b/gcc/testsuite/gcc.dg/winline-3.c index 0540a24..6c5d6ae 100644 --- a/gcc/testsuite/gcc.dg/winline-3.c +++ b/gcc/testsuite/gcc.dg/winline-3.c @@ -17,5 +17,5 @@ inline int q(void) /* { dg-warning "max-inline-insns-single" "" } */ } inline int t (void) { - return q (); /* { dg-warning "called from here" "" } */ + return q (); /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.dg/winline-5.c b/gcc/testsuite/gcc.dg/winline-5.c index da4be45..a587e96 100644 --- a/gcc/testsuite/gcc.dg/winline-5.c +++ b/gcc/testsuite/gcc.dg/winline-5.c @@ -17,5 +17,5 @@ inline int q(void) /* { dg-warning "inline-unit-growth" } */ } int t (void) { - return q (); /* { dg-warning "called from here" } */ + return q (); /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.dg/winline-6.c b/gcc/testsuite/gcc.dg/winline-6.c index 35e3aac..9e89976 100644 --- a/gcc/testsuite/gcc.dg/winline-6.c +++ b/gcc/testsuite/gcc.dg/winline-6.c @@ -17,5 +17,5 @@ inline int q(void) /* { dg-warning "large-function-growth" } */ } inline int t (void) { - return q () + 1; /* { dg-warning "called from here" } */ + return q () + 1; /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.dg/winline-7.c b/gcc/testsuite/gcc.dg/winline-7.c index e3ac129..34deca4 100644 --- a/gcc/testsuite/gcc.dg/winline-7.c +++ b/gcc/testsuite/gcc.dg/winline-7.c @@ -11,5 +11,5 @@ inline void *q (void) /* { dg-warning "(function not inlinable|alloca)" } */ } inline void *t (void) { - return q (); /* { dg-warning "called from here" } */ + return q (); /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.dg/winline-9.c b/gcc/testsuite/gcc.dg/winline-9.c index c8b18c9..f97a764 100644 --- a/gcc/testsuite/gcc.dg/winline-9.c +++ b/gcc/testsuite/gcc.dg/winline-9.c @@ -22,5 +22,5 @@ t() if (a) aa(); if (b) - bb(); /* { dg-warning "called from here" "" } */ + bb(); /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.target/i386/inline_error.c b/gcc/testsuite/gcc.target/i386/inline_error.c index da1cea1..18e5066 100644 --- a/gcc/testsuite/gcc.target/i386/inline_error.c +++ b/gcc/testsuite/gcc.target/i386/inline_error.c @@ -9,5 +9,5 @@ foo () /* { dg-error "inlining failed in call to always_inline .* target specifi int bar() { - return foo (); /* { dg-error "called from here" } */ + return foo (); /* { dg-message "called from here" } */ } diff --git a/gcc/testsuite/gcc.target/i386/intrinsics_5.c b/gcc/testsuite/gcc.target/i386/intrinsics_5.c index e4486b1..6fd7174 100644 --- a/gcc/testsuite/gcc.target/i386/intrinsics_5.c +++ b/gcc/testsuite/gcc.target/i386/intrinsics_5.c @@ -10,7 +10,7 @@ __m128i foo(__m128i *V) { - return _mm_stream_load_si128(V); /* { dg-error "called from here" } */ + return _mm_stream_load_si128(V); /* { dg-message "called from here" } */ } /* { dg-prune-output ".*inlining failed.*" } */ diff --git a/gcc/testsuite/gcc.target/i386/intrinsics_6.c b/gcc/testsuite/gcc.target/i386/intrinsics_6.c index eea22bb..e586739 100644 --- a/gcc/testsuite/gcc.target/i386/intrinsics_6.c +++ b/gcc/testsuite/gcc.target/i386/intrinsics_6.c @@ -10,7 +10,7 @@ __m128i foo(__m128i *V) { - return _mm_stream_load_si128(V); /* { dg-error "called from here" } */ + return _mm_stream_load_si128(V); /* { dg-message "called from here" } */ } /* { dg-prune-output ".*inlining failed.*" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr57756.c b/gcc/testsuite/gcc.target/i386/pr57756.c index 7edd4b5..25c565c 100644 --- a/gcc/testsuite/gcc.target/i386/pr57756.c +++ b/gcc/testsuite/gcc.target/i386/pr57756.c @@ -11,7 +11,7 @@ __inline int callee () /* { dg-error "inlining failed in call to always_inline" __attribute__((target("sse"))) static __inline int caller () { - return callee(); /* { dg-error "called from here" } */ + return callee(); /* { dg-message "called from here" } */ } int main () diff --git a/gcc/testsuite/gcc.target/i386/pr59789.c b/gcc/testsuite/gcc.target/i386/pr59789.c index b144025..d320578 100644 --- a/gcc/testsuite/gcc.target/i386/pr59789.c +++ b/gcc/testsuite/gcc.target/i386/pr59789.c @@ -18,5 +18,5 @@ _mm_set_epi32 (int __q3, int __q2, int __q1, int __q0) /* { dg-error "target spe __m128i f1(void) { /* { dg-message "warning: SSE vector return without SSE enabled changes the ABI" } */ - return _mm_set_epi32 (0, 0, 0, 0); /* { dg-error "called from here" } */ + return _mm_set_epi32 (0, 0, 0, 0); /* { dg-message "called from here" } */ } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index abaea3f..b787466 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; |