diff options
author | Jeff Law <law@redhat.com> | 2019-05-01 11:33:32 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2019-05-01 11:33:32 -0600 |
commit | d36405344205c58beb1947719345ec80fdc00a34 (patch) | |
tree | dff72bf9a187ac1e44917ac2df46e9c995abc933 /gcc | |
parent | 7ee7c293558326468f84720dca35767632f7b662 (diff) | |
download | gcc-d36405344205c58beb1947719345ec80fdc00a34.zip gcc-d36405344205c58beb1947719345ec80fdc00a34.tar.gz gcc-d36405344205c58beb1947719345ec80fdc00a34.tar.bz2 |
re PR tree-optimization/88797 (Unneeded branch added when function is inlined (function runs faster if not inlined))
PR tree-optimization/88797
* gimple-ssa-split-paths (is_feasible_trace): Reject cases where the
PHI feeds a conditional on the RHS of an assignment.
PR tree-optimization/88797
* g++.dg/tree-ssa/pr88797.C: New test.
From-SVN: r270775
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimple-ssa-split-paths.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tree-ssa/pr88797.C | 16 |
4 files changed, 33 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b6b501f..7f6ccd9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-05-01 Jeff Law <law@redhat.com> + + PR tree-optimization/88797 + * gimple-ssa-split-paths (is_feasible_trace): Reject cases where the + PHI feeds a conditional on the RHS of an assignment. + 2019-04-30 Andrew Waterman <andrew@sifive.com> Jim Wilson <jimw@sifive.com> diff --git a/gcc/gimple-ssa-split-paths.c b/gcc/gimple-ssa-split-paths.c index 33bbb66..5bf45ee 100644 --- a/gcc/gimple-ssa-split-paths.c +++ b/gcc/gimple-ssa-split-paths.c @@ -264,8 +264,12 @@ is_feasible_trace (basic_block bb) if (is_gimple_debug (stmt)) continue; /* If there's a use in the joiner this might be a CSE/DCE - opportunity. */ - if (gimple_bb (stmt) == bb) + opportunity, but not if the use is in a conditional + which makes this a likely if-conversion candidate. */ + if (gimple_bb (stmt) == bb + && (!is_gimple_assign (stmt) + || (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) + != tcc_comparison))) { found_useful_phi = true; break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1427a8e..3620c23 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-01 Jeff Law <law@redhat.com> + + PR tree-optimization/90037 + * g++.dg/tree-ssa/pr88797.C: New test. + 2019-05-01 Nathan Sidwell <nathan@acm.org> * g++.dg/cpp0x/decltype9.C: Adjust expected diagnostics. diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr88797.C b/gcc/testsuite/g++.dg/tree-ssa/pr88797.C new file mode 100644 index 0000000..75391d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr88797.C @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-split-paths-details" } */ + + +void use(unsigned); +bool f(unsigned x, unsigned y) { + return x < 1111 + (y <= 2222); +} +void test_f(unsigned x, unsigned y) { + for (unsigned i = 0; i < 3333; ++i) + use(f(x++, y++)); +} + +/* { dg-final { scan-tree-dump-not "Duplicating join block" "split-paths" } } */ +/* { dg-final { scan-tree-dump-times "Block . is a join that does not expose" 1 "split-paths" } } */ + |