Re: pure/const function attribute and memoization

2013-05-20 Thread Jan Hubicka
> > > > The function is in glibc's math/atest-exp2.c file. I see, I was curious what made LLVM developers to implement the feature about making memory writes unreachable. While I see wild interpretation of the documentation allows it,

Re: pure/const function attribute and memoization

2013-05-18 Thread Florian Weimer
On 05/18/2013 10:02 PM, Jan Hubicka wrote: On 05/15/2013 11:01 AM, Richard Biener wrote: Now - if there would ever be an architecture where special call-site preparation is required for a callee to write to global memory then marking a function 'const' when it does in fact write to global memor

Re: pure/const function attribute and memoization

2013-05-18 Thread Jan Hubicka
> On 05/15/2013 11:01 AM, Richard Biener wrote: > >Now - if there would ever be an architecture where special call-site > >preparation > >is required for a callee to write to global memory then marking a function > >'const' > >when it does in fact write to global memory then GCC may choose to opt

Re: pure/const function attribute and memoization

2013-05-15 Thread Richard Biener
On Wed, May 15, 2013 at 11:12 AM, Florian Weimer wrote: > On 05/15/2013 11:01 AM, Richard Biener wrote: >> >> Now - if there would ever be an architecture where special call-site >> preparation >> is required for a callee to write to global memory then marking a function >> 'const' >> when it does

Re: pure/const function attribute and memoization

2013-05-15 Thread Florian Weimer
On 05/15/2013 11:01 AM, Richard Biener wrote: Now - if there would ever be an architecture where special call-site preparation is required for a callee to write to global memory then marking a function 'const' when it does in fact write to global memory then GCC may choose to optimize the call s

Re: pure/const function attribute and memoization

2013-05-15 Thread Richard Biener
On Wed, May 15, 2013 at 9:50 AM, Florian Weimer wrote: > Back when these attributes were defined, we had no inter-procedural analysis > or other fanciness, so I suspect we didn't consider the case where the > annotated function only behaved as if it were pure or const. One important > case is memo

pure/const function attribute and memoization

2013-05-15 Thread Florian Weimer
Back when these attributes were defined, we had no inter-procedural analysis or other fanciness, so I suspect we didn't consider the case where the annotated function only behaved as if it were pure or const. One important case is memoization—a function which uses this technique writes to globa