aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2019-07-17 14:58:23 -0600
committerJeff Law <law@gcc.gnu.org>2019-07-17 14:58:23 -0600
commitcaffb6e56c2914e64e65f3c336b770c178f265a3 (patch)
tree535dae052cce971b9c476c0dc7d59fcd31c4961c /gcc/tree-ssa-dse.c
parent3697a5b8db822f91fad4516b3c625ff2f48993ce (diff)
downloadgcc-caffb6e56c2914e64e65f3c336b770c178f265a3.zip
gcc-caffb6e56c2914e64e65f3c336b770c178f265a3.tar.gz
gcc-caffb6e56c2914e64e65f3c336b770c178f265a3.tar.bz2
tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting.
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting. (dse_walker::dse_optimize_stmt): Likewise. Add missing return to avoid unexpected switch statement fallthru. From-SVN: r273556
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c161
1 files changed, 81 insertions, 80 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index df05a55..9bdcf9a 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -107,42 +107,42 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write)
{
switch (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)))
{
- case BUILT_IN_MEMCPY:
- case BUILT_IN_MEMMOVE:
- case BUILT_IN_MEMSET:
- case BUILT_IN_MEMCPY_CHK:
- case BUILT_IN_MEMMOVE_CHK:
- case BUILT_IN_MEMSET_CHK:
- {
- tree size = NULL_TREE;
- if (gimple_call_num_args (stmt) == 3)
- size = gimple_call_arg (stmt, 2);
- tree ptr = gimple_call_arg (stmt, 0);
- ao_ref_init_from_ptr_and_size (write, ptr, size);
- return true;
- }
+ case BUILT_IN_MEMCPY:
+ case BUILT_IN_MEMMOVE:
+ case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMSET_CHK:
+ {
+ tree size = NULL_TREE;
+ if (gimple_call_num_args (stmt) == 3)
+ size = gimple_call_arg (stmt, 2);
+ tree ptr = gimple_call_arg (stmt, 0);
+ ao_ref_init_from_ptr_and_size (write, ptr, size);
+ return true;
+ }
- /* A calloc call can never be dead, but it can make
- subsequent stores redundant if they store 0 into
- the same memory locations. */
- case BUILT_IN_CALLOC:
- {
- tree nelem = gimple_call_arg (stmt, 0);
- tree selem = gimple_call_arg (stmt, 1);
- tree lhs;
- if (TREE_CODE (nelem) == INTEGER_CST
- && TREE_CODE (selem) == INTEGER_CST
- && (lhs = gimple_call_lhs (stmt)) != NULL_TREE)
- {
- tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem),
- nelem, selem);
- ao_ref_init_from_ptr_and_size (write, lhs, size);
- return true;
- }
- }
+ /* A calloc call can never be dead, but it can make
+ subsequent stores redundant if they store 0 into
+ the same memory locations. */
+ case BUILT_IN_CALLOC:
+ {
+ tree nelem = gimple_call_arg (stmt, 0);
+ tree selem = gimple_call_arg (stmt, 1);
+ tree lhs;
+ if (TREE_CODE (nelem) == INTEGER_CST
+ && TREE_CODE (selem) == INTEGER_CST
+ && (lhs = gimple_call_lhs (stmt)) != NULL_TREE)
+ {
+ tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem),
+ nelem, selem);
+ ao_ref_init_from_ptr_and_size (write, lhs, size);
+ return true;
+ }
+ }
- default:
- break;
+ default:
+ break;
}
}
else if (is_gimple_assign (stmt))
@@ -964,57 +964,58 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi)
tree fndecl = gimple_call_fndecl (stmt);
switch (DECL_FUNCTION_CODE (fndecl))
{
- case BUILT_IN_MEMCPY:
- case BUILT_IN_MEMMOVE:
- case BUILT_IN_MEMSET:
- case BUILT_IN_MEMCPY_CHK:
- case BUILT_IN_MEMMOVE_CHK:
- case BUILT_IN_MEMSET_CHK:
- {
- /* Occasionally calls with an explicit length of zero
- show up in the IL. It's pointless to do analysis
- on them, they're trivially dead. */
- tree size = gimple_call_arg (stmt, 2);
- if (integer_zerop (size))
- {
- delete_dead_or_redundant_call (gsi, "dead");
- return;
- }
-
- /* If this is a memset call that initializes an object
- to zero, it may be redundant with an earlier memset
- or empty CONSTRUCTOR of a larger object. */
- if ((DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET
- || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET_CHK)
- && integer_zerop (gimple_call_arg (stmt, 1)))
- dse_optimize_redundant_stores (stmt);
-
- enum dse_store_status store_status;
- m_byte_tracking_enabled
- = setup_live_bytes_from_ref (&ref, m_live_bytes);
- store_status = dse_classify_store (&ref, stmt,
- m_byte_tracking_enabled,
- m_live_bytes);
- if (store_status == DSE_STORE_LIVE)
- return;
-
- if (store_status == DSE_STORE_MAYBE_PARTIAL_DEAD)
- {
- maybe_trim_memstar_call (&ref, m_live_bytes, stmt);
- return;
- }
-
- if (store_status == DSE_STORE_DEAD)
+ case BUILT_IN_MEMCPY:
+ case BUILT_IN_MEMMOVE:
+ case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMSET_CHK:
+ {
+ /* Occasionally calls with an explicit length of zero
+ show up in the IL. It's pointless to do analysis
+ on them, they're trivially dead. */
+ tree size = gimple_call_arg (stmt, 2);
+ if (integer_zerop (size))
+ {
delete_dead_or_redundant_call (gsi, "dead");
+ return;
+ }
+
+ /* If this is a memset call that initializes an object
+ to zero, it may be redundant with an earlier memset
+ or empty CONSTRUCTOR of a larger object. */
+ if ((DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET
+ || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET_CHK)
+ && integer_zerop (gimple_call_arg (stmt, 1)))
+ dse_optimize_redundant_stores (stmt);
+
+ enum dse_store_status store_status;
+ m_byte_tracking_enabled
+ = setup_live_bytes_from_ref (&ref, m_live_bytes);
+ store_status = dse_classify_store (&ref, stmt,
+ m_byte_tracking_enabled,
+ m_live_bytes);
+ if (store_status == DSE_STORE_LIVE)
return;
- }
- case BUILT_IN_CALLOC:
- /* We already know the arguments are integer constants. */
- dse_optimize_redundant_stores (stmt);
+ if (store_status == DSE_STORE_MAYBE_PARTIAL_DEAD)
+ {
+ maybe_trim_memstar_call (&ref, m_live_bytes, stmt);
+ return;
+ }
- default:
+ if (store_status == DSE_STORE_DEAD)
+ delete_dead_or_redundant_call (gsi, "dead");
return;
+ }
+
+ case BUILT_IN_CALLOC:
+ /* We already know the arguments are integer constants. */
+ dse_optimize_redundant_stores (stmt);
+ return;
+
+ default:
+ return;
}
}