How to avoid constant propagation into functions?
Alexander Monakov
amonakov@ispras.ru
Fri Dec 9 13:13:00 GMT 2016
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
More information about the Gcc
mailing list