Re: [PING][RFC] Assertions as optimization hints

2016-12-02 Thread Vincent Lefevre
On 2016-11-28 18:49:55 +, Yuri Gribov wrote: > On Mon, Nov 28, 2016 at 4:03 PM, Vincent Lefevre > wrote: > > Concerning the "per-project decision", I'm not sure that's a good > > idea: as soon as one includes a header file, __ASSUME_ASSERTS__ > > could potentially

Re: [PING][RFC] Assertions as optimization hints

2016-11-28 Thread Yuri Gribov
On Mon, Nov 28, 2016 at 4:03 PM, Vincent Lefevre wrote: > On 2016-11-23 16:03:44 +, Yuri Gribov wrote: >> Definitely, aggressively abusing assertions like this should be a >> per-project decision. E.g. I've seen code which parallels assertions >> with error checking

Re: [PING][RFC] Assertions as optimization hints

2016-11-28 Thread Vincent Lefevre
On 2016-11-23 16:03:44 +, Yuri Gribov wrote: > Definitely, aggressively abusing assertions like this should be a > per-project decision. E.g. I've seen code which parallels assertions > with error checking i.e. something like > FILE *p = fopen(...); > assert(p); // Quickly abort in debug

Re: [PING][RFC] Assertions as optimization hints

2016-11-27 Thread Allan Sandfeld Jensen
On Wednesday 23 November 2016, Richard Biener wrote: > On Tue, Nov 22, 2016 at 6:52 PM, Yuri Gribov wrote: > > Hi all, > > > > I've recently revisited an ancient patch from Paolo > > (https://gcc.gnu.org/ml/gcc-patches/2004-04/msg00551.html) which uses > > asserts as

Re: [PING][RFC] Assertions as optimization hints

2016-11-27 Thread Soul Studios
The main problem with __assume is that it should never be used. Literally, if you have to use it, then the code it refers to should actually be commented out. ps. This is a bit of a simplification - I should have stated, if the assumption is wrong, it can lead to dangerous code which breaks.

Re: [PING][RFC] Assertions as optimization hints

2016-11-27 Thread Soul Studios
Does this approach make sense in general? If it does I can probably come up with more measurements. Sounds good to me-not sure why there hasn't been more response to this, it seems logical- if functions can make assumptions such as pointerA != pointerB then that leads the way for avoiding

Re: [PING][RFC] Assertions as optimization hints

2016-11-23 Thread Yuri Gribov
On Wed, Nov 23, 2016 at 11:31 AM, Richard Biener wrote: > On Tue, Nov 22, 2016 at 6:52 PM, Yuri Gribov wrote: >> Hi all, >> >> I've recently revisited an ancient patch from Paolo >> (https://gcc.gnu.org/ml/gcc-patches/2004-04/msg00551.html) which

Re: [PING][RFC] Assertions as optimization hints

2016-11-23 Thread Richard Biener
On Tue, Nov 22, 2016 at 6:52 PM, Yuri Gribov wrote: > Hi all, > > I've recently revisited an ancient patch from Paolo > (https://gcc.gnu.org/ml/gcc-patches/2004-04/msg00551.html) which uses > asserts as optimization hints. I've rewritten the patch to be more > stable under

[PING][RFC] Assertions as optimization hints

2016-11-22 Thread Yuri Gribov
Hi all, I've recently revisited an ancient patch from Paolo (https://gcc.gnu.org/ml/gcc-patches/2004-04/msg00551.html) which uses asserts as optimization hints. I've rewritten the patch to be more stable under expressions with side-effects and did some basic investigation of it's efficacy.