This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fix pr25446


The attached patch fixes PR/25446, which is the result of a bad
interaction between vect-ifcvt-9.c and -fPIC.  The testcase boils down
to:

void foo ()  __attribute__((always_inline));
void foo (...)
{
  ...vectorizable loop...
}

int main ()
{
  foo (...);
  return 0;
}

with a dg-final check to ensure the loop is vectorized *twice*: once in
the definition of 'foo' and once when 'foo' is inlined into 'main'.

When -fPIC is active, however, 'foo' is not marked as inlinable due to
c_cannot_inline_tree_fn only checking

  !DECL_DECLARED_INLINE_P (fn) && !targetm.binds_local_p (fn))

when determining that the function cannot be auto-inlined.  Note that
it does not check whether the function has the always_inline attribute.
Since 'foo', above, is declared always_inline but is not declared
inline, the above test succeeds and c_cannot_inline_tree_fn indicates
that 'foo' may not be inlined.

The attached patch adds a check for the absence of the always_inline
attribute to the above condition.

Bootstrapped and lightly regtested on i586-wrs-vxworks (the testcase now
passes as expected with or without -fPIC).  OK to commit after full
testing completes?

-Nathan

gcc/
2007-07-26  Nathan Froyd  <froydnj@codesourcery.com>

	PR/25446
	* c-objc-common.c (c_cannot_inline_tree_fn): Check for an
	always_inline attribute on the function decl.

Attachment: pr25446.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]