diff options
author | Richard Biener <rguenther@suse.de> | 2020-04-02 10:46:20 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-04-02 16:53:21 +0200 |
commit | 75efe9cb1f8938a713ce540dc3b27bc2afcd3fae (patch) | |
tree | 69f0c6905f576eeedd84101d3bfb66a72a2c4331 /gcc/c-family | |
parent | 54af95767e887d63dc332731738e642536d87a48 (diff) | |
download | gcc-75efe9cb1f8938a713ce540dc3b27bc2afcd3fae.zip gcc-75efe9cb1f8938a713ce540dc3b27bc2afcd3fae.tar.gz gcc-75efe9cb1f8938a713ce540dc3b27bc2afcd3fae.tar.bz2 |
c/94392 - only enable -ffinite-loops for C++
This does away with enabling -ffinite-loops at -O2+ for all languages
and instead enables it selectively for C++ only.
It also makes -ffinite-loops loop-private at CFG construction time
fixing correctness issues with inlining.
2020-04-02 Richard Biener <rguenther@suse.de>
PR c/94392
* c-opts.c (c_common_post_options): Enable -ffinite-loops
for -O2 and C++11 or newer.
* common.opt (ffinite-loops): Initialize to zero.
* opts.c (default_options_table): Remove OPT_ffinite_loops
entry.
* cfgloop.h (loop::finite_p): New member.
* cfgloopmanip.c (copy_loop_info): Copy finite_p.
* ipa-icf-gimple.c (func_checker::compare_loops): Compare
finite_p.
* lto-streamer-in.c (input_cfg): Stream finite_p.
* lto-streamer-out.c (output_cfg): Likewise.
* tree-cfg.c (replace_loop_annotate): Initialize finite_p
from flag_finite_loops at CFG build time.
* tree-ssa-loop-niter.c (finite_loop_p): Check the loops
finite_p flag instead of flag_finite_loops.
* doc/invoke.texi (ffinite-loops): Adjust documentation of
default setting.
* gcc.dg/torture/pr94392.c: New testcase.
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 38406a8..92aed0e 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2020-04-02 Richard Biener <rguenther@suse.de> + + PR c/94392 + * c-opts.c (c_common_post_options): Enable -ffinite-loops + for -O2 and C++11 or newer. + 2020-03-28 Patrick Palka <ppalka@redhat.com> * c.opt: Add -fconcepts-diagnostics-depth. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 6b6c754..58ba094 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -989,6 +989,10 @@ c_common_post_options (const char **pfilename) SET_OPTION_IF_UNSET (&global_options, &global_options_set, flag_new_ttp, cxx_dialect >= cxx17); + /* C++11 guarantees forward progress. */ + SET_OPTION_IF_UNSET (&global_options, &global_options_set, flag_finite_loops, + optimize >= 2 && cxx_dialect >= cxx11); + if (cxx_dialect >= cxx11) { /* If we're allowing C++0x constructs, don't warn about C++98 |