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] |
On Wed, 25 Nov 2015, Jakub Jelinek wrote:
On Wed, Nov 25, 2015 at 09:58:15AM +0100, Marc Glisse wrote:I guess it got lost in my text, but if a user writes: unsigned diff = a - b; if (b > a) { /* overflow */ ... } else { ... } Your patch will not detect it. It seems that replacing x-y>x with y>x couldSorry, already committed the patch (without incremental that hasn't been tested anyway).
Sorry, I never meant to imply that your patch was wrong in any way or should be blocked, I like it. I was only discussing possible future improvements...
It is true that the patch does not detect this, but it is harder that way. What if it is if (b > a) ... // Huge amount of code r = a - b; ? Trying to emit the subtraction above the comparison would then very likely increase register preassure.
The same is true whether we write it b > a or (a - b) > a (I don't think PRE + SCCVN avoid increasing register pressure).
So, I'd really prefer doing x-y>x to y>x only for single use.
Ok (for now). -- Marc Glisse
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |