[Bug tree-optimization/68131] missed optimization and warning for broken overflow check
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68131 --- Comment #5 from Andrew Pinski --- (In reply to Marc Glisse from comment #3) > (In reply to Richard Biener from comment #2) > > We indeed do not have this optimization, only A + CST CMP CST to A CMP CST' > > and related. Note that _9 might be negative so we also need range info > > for this. VRPs symbolic range stuff isn't good enough to simplify this. > > If we want to simplify directly to false, I would expect a match.pd pattern > using tree_expr_nonnegative_p to work in this case (conversion from a > smaller unsigned). By the way, maybe tree_single_nonnegative_warnv_p could > try looking at get_range_info before forwarding to > gimple_stmt_nonnegative_warnv_p. Oh I filed PR 111959 (and will be submitting a patch later today) for that.
[Bug tree-optimization/68131] missed optimization and warning for broken overflow check
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68131 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |8.0 Known to work||8.1.0 Resolution|--- |FIXED Status|NEW |RESOLVED Known to fail||7.5.0 --- Comment #4 from Andrew Pinski --- Fixed by r8-3771. There is no overflow here as unsigned short gets prompted to int and such.
[Bug tree-optimization/68131] missed optimization and warning for broken overflow check
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68131 Marc Glisse changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2015-10-28 Component|rtl-optimization|tree-optimization Ever confirmed|0 |1 --- Comment #1 from Marc Glisse --- (in type int) _10 = _6 + _9; if (_6 > _10) Indeed we fail to simplify that for some reason. If we did simplify, it might print one of those "assuming signed overflow does not occur when assuming that (X + c) < X is always false" warnings.
[Bug tree-optimization/68131] missed optimization and warning for broken overflow check
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68131 --- Comment #3 from Marc Glisse --- (In reply to Richard Biener from comment #2) > We indeed do not have this optimization, only A + CST CMP CST to A CMP CST' > and related. Note that _9 might be negative so we also need range info > for this. VRPs symbolic range stuff isn't good enough to simplify this. If we want to simplify directly to false, I would expect a match.pd pattern using tree_expr_nonnegative_p to work in this case (conversion from a smaller unsigned). By the way, maybe tree_single_nonnegative_warnv_p could try looking at get_range_info before forwarding to gimple_stmt_nonnegative_warnv_p. But the much simpler transformation: a+b b<0 does not require any VRP info and would let the next VRP pass finish the work.
[Bug tree-optimization/68131] missed optimization and warning for broken overflow check
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68131 Richard Biener changed: What|Removed |Added Keywords||missed-optimization --- Comment #2 from Richard Biener --- We indeed do not have this optimization, only A + CST CMP CST to A CMP CST' and related. Note that _9 might be negative so we also need range info for this. VRPs symbolic range stuff isn't good enough to simplify this.