diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2016-05-18 14:01:31 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2016-05-18 14:01:31 +0000 |
commit | cf8be00de9a9e31a2f05894d429fe38948a0c255 (patch) | |
tree | a8b6d0e0b1940214a97b2c5e39a0e3fd1e099cf9 /gcc/tree-dfa.c | |
parent | 29799e9db1ee2bcb8113d96adc965c7a1a284aaa (diff) | |
download | gcc-cf8be00de9a9e31a2f05894d429fe38948a0c255.zip gcc-cf8be00de9a9e31a2f05894d429fe38948a0c255.tar.gz gcc-cf8be00de9a9e31a2f05894d429fe38948a0c255.tar.bz2 |
To...
To: gcc-patches@gcc.gnu.org
Subject: PR 71020: Handle abnormal PHIs in tree-call-cdce.c
From: Richard Sandiford <richard.sandiford@arm.com>
Gcc: private.sent
--text follows this line--
The PR is about a case where tree-call-cdce.c causes two abnormal
PHIs for the same variable to be live at the same time, leading to
a coalescing failure. It seemed like getting rid of these kinds of
input would be generally useful, so I added a utility to tree-dfa.c.
Tested on x86_64-linux-gnu.
gcc/
PR middle-end/71020
* tree-dfa.h (replace_abnormal_ssa_names): Declare.
* tree-dfa.c (replace_abnormal_ssa_names): New function.
* tree-call-cdce.c: Include tree-dfa.h.
(can_guard_call_p): New function, extracted from...
(can_use_internal_fn): ...here.
(shrink_wrap_one_built_in_call_with_conds): Remove failure path
and return void.
(shrink_wrap_one_built_in_call): Likewise.
(use_internal_fn): Likewise.
(shrink_wrap_conditional_dead_built_in_calls): Update accordingly
and return void. Call replace_abnormal_ssa_names.
(pass_call_cdce::execute): Check can_guard_call_p during the
initial walk. Assume shrink_wrap_conditional_dead_built_in_calls
will always change something.
gcc/testsuite/
* gcc.dg/torture/pr71020.c: New test.
From-SVN: r236393
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r-- | gcc/tree-dfa.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index f6986c1..9a3b072 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -823,6 +823,29 @@ stmt_references_abnormal_ssa_name (gimple *stmt) return false; } +/* If STMT takes any abnormal PHI values as input, replace them with + local copies. */ + +void +replace_abnormal_ssa_names (gimple *stmt) +{ + ssa_op_iter oi; + use_operand_p use_p; + + FOR_EACH_SSA_USE_OPERAND (use_p, stmt, oi, SSA_OP_USE) + { + tree op = USE_FROM_PTR (use_p); + if (TREE_CODE (op) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op)) + { + gimple_stmt_iterator gsi = gsi_for_stmt (stmt); + tree new_name = make_ssa_name (TREE_TYPE (op)); + gassign *assign = gimple_build_assign (new_name, op); + gsi_insert_before (&gsi, assign, GSI_SAME_STMT); + SET_USE (use_p, new_name); + } + } +} + /* Pair of tree and a sorting index, for dump_enumerated_decls. */ struct GTY(()) numbered_tree { |