On Mon, Jan 13, 2014 at 12:11 PM, H.J. Lu <hongjiu...@intel.com> wrote: > Hi, > > We should report some early inlining errors. This patch is based on > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57698#c7 > > It adds report_early_inliner_always_inline_failure and uses it in > expand_call_inline. Tested on Linux/x86-64. OK to install? > > Thanks. > > > H.J. > ---- > commit 7b18b53d308b2c25bef5664be3e6544249d86bdc > Author: H.J. Lu <hjl.to...@gmail.com> > Date: Mon Jan 13 11:54:36 2014 -0800 > > Update error handling during early_inlining > > diff --git a/gcc/ChangeLog b/gcc/ChangeLog > index 5c674bc..284bc66 100644 > --- a/gcc/ChangeLog > +++ b/gcc/ChangeLog > @@ -1,3 +1,12 @@ > +2014-01-13 Sriraman Tallam <tmsri...@google.com> > + H.J. Lu <hongjiu...@intel.com> > + > + PR middle-end/59789 > + * tree-inline.c (report_early_inliner_always_inline_failure): New > + function. > + (expand_call_inline): Emit errors during early_inlining if > + report_early_inliner_always_inline_failure returns true. > + > 2014-01-10 DJ Delorie <d...@redhat.com> > > * config/msp430/msp430.md (call_internal): Don't allow memory > diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog > index 459e365..2a7b3ca 100644 > --- a/gcc/testsuite/ChangeLog > +++ b/gcc/testsuite/ChangeLog > @@ -1,3 +1,8 @@ > +2014-01-13 H.J. Lu <hongjiu...@intel.com> > + > + PR middle-end/59789 > + * gcc.target/i386/pr59789.c: New testcase. > + > 2014-01-13 Jakub Jelinek <ja...@redhat.com> > > PR tree-optimization/59387 > diff --git a/gcc/testsuite/gcc.target/i386/pr59789.c > b/gcc/testsuite/gcc.target/i386/pr59789.c > new file mode 100644 > index 0000000..b476d6c > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/pr59789.c > @@ -0,0 +1,22 @@ > +/* { dg-do compile } */ > +/* { dg-require-effective-target ia32 } */ > +/* { dg-options "-O -march=i686" } */ > + > +#pragma GCC push_options > +#pragma GCC target("sse2") > +typedef int __v4si __attribute__ ((__vector_size__ (16))); > +typedef long long __m128i __attribute__ ((__vector_size__ (16), > __may_alias__)); > + > +extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, > __artificial__)) > +_mm_set_epi32 (int __q3, int __q2, int __q1, int __q0) /* { dg-error "target > specific option mismatch" } */ > +{ > + return __extension__ (__m128i)(__v4si){ __q0, __q1, __q2, __q3 }; > +} > +#pragma GCC pop_options > + > + > +__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" } */ > +} > diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c > index 22521b1..ce1e3af 100644 > --- a/gcc/tree-inline.c > +++ b/gcc/tree-inline.c > @@ -4046,6 +4046,32 @@ add_local_variables (struct function *callee, struct > function *caller, > } > } > > +/* Should an error be reported when early inliner fails to inline an > + always_inline function? That depends on the REASON. */ > + > +static inline bool > +report_early_inliner_always_inline_failure (cgraph_inline_failed_t reason) > +{ > + /* Only the following reasons need to be reported when the early inliner > + fails to inline an always_inline function. Called from > + expand_call_inline. */ > + switch (reason) > + { > + case CIF_BODY_NOT_AVAILABLE: > + case CIF_FUNCTION_NOT_INLINABLE: > + case CIF_OVERWRITABLE: > + case CIF_MISMATCHED_ARGUMENTS: > + case CIF_EH_PERSONALITY: > + case CIF_UNSPECIFIED: > + case CIF_NON_CALL_EXCEPTIONS: > + case CIF_TARGET_OPTION_MISMATCH: > + case CIF_OPTIMIZATION_MISMATCH: > + return true; > + default: > + return false; > + } > +} > + > /* If STMT is a GIMPLE_CALL, replace it with its inline expansion. */ > > static bool > @@ -4116,7 +4142,8 @@ expand_call_inline (basic_block bb, gimple stmt, > copy_body_data *id) > /* During early inline pass, report only when optimization is > not turned on. */ > && (cgraph_global_info_ready > - || !optimize) > + || !optimize > + || report_early_inliner_always_inline_failure (reason)) > /* PR 20090218-1_0.c. Body can be provided by another module. */ > && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) > {
Hi Honza, Can you take a look at this patch? Thanks. -- H.J.