aboutsummaryrefslogtreecommitdiff
path: root/gcc/config.gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-03-02 11:49:12 +0100
committerJakub Jelinek <jakub@redhat.com>2021-03-02 11:49:12 +0100
commitff92ede8d269375f800e1b347a48f4698874b4a3 (patch)
treea77af38a16da2a77218273664f41647e781821da /gcc/config.gcc
parent34d39d140913d17f3c207dc3fb4fd45dd90e4360 (diff)
downloadgcc-ff92ede8d269375f800e1b347a48f4698874b4a3.zip
gcc-ff92ede8d269375f800e1b347a48f4698874b4a3.tar.gz
gcc-ff92ede8d269375f800e1b347a48f4698874b4a3.tar.bz2
vrp: Improve register_edge_assert_for [PR95757]
The Wstringop-overflow-25.c testcase doesn't emit one of the expected warnings on targets that don't do short curcuiting due to target costs (or e.g. with --param=logical-op-non-short-circuit=0 on all targets). The problem is that only reassoc2 optimizes: _49 ={v} unsigned_value_source; if (_49 == 0) goto <bb 7>; [50.00%] else goto <bb 5>; [50.00%] <bb 5> [local count: 536870913]: if (_49 > 2) goto <bb 7>; [50.00%] else goto <bb 6>; [50.00%] <bb 6> [local count: 268435457]: _53 = _49 + 1; into: _49 ={v} unsigned_value_source; _48 = _49 + 18446744073709551615; _1 = _48 > 1; if (_1 != 0) goto <bb 6>; [50.00%] else goto <bb 5>; [50.00%] <bb 5> [local count: 268435457]: _53 = _49 + 1; (but, note the _1 = _48 > 1; if (_1 != 0)), then dom3 is run and because of that if (_1 != 0) vs. if (_48 > 1) doesn't register edge asserts for _48 and _49) and so we don't get SSA_NAME_RANGE_INFO for _53 (and ditto for vrp2) and only afterwards comes forwprop4 that canonicalizes it to if (_48 > 1). While with --param=logical-op-non-short-circuit=1 it is already reassoc1 that optimizes it and forwprop3 that propagates it, so we have on the SSA_NAME corresponding to _53 above SSA_NAME_RANGE_INFO and during expansion we warn. The following patch fixes it by handling those not yet propagated comparisons into GIMPLE_COND in register_edge_assert_for. We already have all the infrastructure there to handle the --param=logical-op-non-short-circuit=1 | and &s. 2021-03-02 Jakub Jelinek <jakub@redhat.com> PR middle-end/95757 * tree-vrp.c (register_edge_assert_for): Remove superfluous ()s around condition. Call register_edge_assert_for_1 for == 0, != 0, == 1 and != 1 comparisons if name is lhs of a comparison.
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions