This is the mail archive of the gcc@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]

Re: How to avoid constant propagation into functions?


On Fri, 9 Dec 2016, Richard Biener wrote:
> Right, 'used' thwarts IPA on the callee side only.  noclone and noinline are
> attributes affecting the caller side but we indeed miss attributes for the
> properties you mention above.  I suppose adding a catch-all attribute for
> caller side effects (like we have 'used' for the callee side) would be a good
> idea.

For general uses, i.e. for testcases that ought to be portable across different
compilers, I believe making a call through a volatile pointer already places a
sufficient compiler barrier to prevent both caller- and callee-side analysis.
That is, where you have

  int foo(int);
  foo(arg);

you could transform it to

  int foo(int);
  int (* volatile vpfoo)(int) = foo;
  vpfoo(arg);

While this also has an effect of forcing the call to be indirect, I think
usually that should be acceptable.

But for uses in the gcc testsuite, I believe an attribute is still needed.

Alexander


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