diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2021-09-27 16:41:01 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2021-09-28 08:17:29 +0200 |
commit | e475ae9bbf0c85a7d60f236c5a744e163a9ef7b8 (patch) | |
tree | edf942bb62820aa08cba690bfa55461e4397699b /gcc/tree-ssa-threadedge.c | |
parent | 9cfb95f9b92326e86e99b50350ebf04fa9cd2477 (diff) | |
download | gcc-e475ae9bbf0c85a7d60f236c5a744e163a9ef7b8.zip gcc-e475ae9bbf0c85a7d60f236c5a744e163a9ef7b8.tar.gz gcc-e475ae9bbf0c85a7d60f236c5a744e163a9ef7b8.tar.bz2 |
Control all jump threading passes with -fjump-threads.
Last year I mentioned that -fthread-jumps was being ignored by the
majority of our jump threading passes, and Jeff said he'd be in favor
of fixing this.
This patch remedies the situation, but it does change existing behavior.
Currently -fthread-jumps is only enabled for -O2, -O3, and -Os. This
means that even if we restricted all jump threading passes with
-fthread-jumps, DOM jump threading would still seep through since it
runs at -O1.
I propose this patch, but it does mean that DOM jump threading would
have to be explicitly enabled with -O1 -fthread-jumps.
gcc/ChangeLog:
* tree-ssa-threadbackward.c (pass_thread_jumps::gate): Check
flag_thread_jumps.
(pass_early_thread_jumps::gate): Same.
* tree-ssa-threadedge.c (jump_threader::thread_outgoing_edges):
Return if !flag_thread_jumps.
* tree-ssa-threadupdate.c
(jt_path_registry::register_jump_thread): Assert that
flag_thread_jumps is true.
gcc/testsuite/ChangeLog:
* gcc.dg/auto-init-uninit-1.c: Add -fthread-jumps.
* gcc.dg/auto-init-uninit-15.c: Same.
* gcc.dg/guality/example.c: Same.
* gcc.dg/loop-8.c: Same.
* gcc.dg/strlenopt-40.c: Same.
* gcc.dg/tree-ssa/pr18133-2.c: Same.
* gcc.dg/tree-ssa/pr18134.c: Same.
* gcc.dg/uninit-1.c: Same.
* gcc.dg/uninit-pr44547.c: Same.
* gcc.dg/uninit-pr59970.c: Same.
Diffstat (limited to 'gcc/tree-ssa-threadedge.c')
-rw-r--r-- | gcc/tree-ssa-threadedge.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 0b59cb4..a63a976 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -1196,6 +1196,9 @@ jump_threader::thread_outgoing_edges (basic_block bb) int flags = (EDGE_IGNORE | EDGE_COMPLEX | EDGE_ABNORMAL); gimple *last; + if (!flag_thread_jumps) + return; + /* If we have an outgoing edge to a block with multiple incoming and outgoing edges, then we may be able to thread the edge, i.e., we may be able to statically determine which of the outgoing edges |