On Fri, Jan 17, 2014 at 7:35 AM, Jan Hubicka <[email protected]> wrote: >> > 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 <[email protected]> >> > + H.J. Lu <[email protected]> >> > + >> > + 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 <[email protected]> >> > >> > * 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 <[email protected]> >> > + >> > + PR middle-end/59789 >> > + * gcc.target/i386/pr59789.c: New testcase. >> > + >> > 2014-01-13 Jakub Jelinek <[email protected]> >> > >> > 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; >> > + } >> > +} > > This looks resonable, but since we have .def file specifying CIF codes, I > would make > this as a flag in there. Perhaps something like CIF_FINAL_ERROR that marks > those and > inliner can report them.
For this testcase, we get CIF_TARGET_OPTION_MISMATCH. Do you want to add a new flag so that inliner can use for other errors? -- H.J.
