===================================================================
@@ -1757,12 +1757,12 @@ gimple_assign_set_rhs_with_ops (gimple_s
tree
gimple_get_lhs (const gimple *stmt)
{
- enum gimple_code code = gimple_code (stmt);
-
- if (code == GIMPLE_ASSIGN)
- return gimple_assign_lhs (stmt);
- else if (code == GIMPLE_CALL)
- return gimple_call_lhs (stmt);
+ if (const gphi *phi = dyn_cast <const gphi *> (stmt))
+ return gimple_phi_result (phi);
+ else if (const gassign *assign = dyn_cast <const gassign *> (stmt))
+ return gimple_assign_lhs (assign);
+ else if (const gcall *call = dyn_cast <const gcall *> (stmt))
+ return gimple_call_lhs (call);
else
return NULL_TREE;
}
===================================================================
@@ -72,20 +72,6 @@ get_rhs_or_phi_arg (gimple *stmt)
}
-/* Given a statement STMT, which is either a PHI node or an assignment,
- return the "lhs" of the node. */
-
-static tree
-get_lhs_or_phi_result (gimple *stmt)
-{
- if (gimple_code (stmt) == GIMPLE_PHI)
- return gimple_phi_result (stmt);
- else if (is_gimple_assign (stmt))
- return gimple_assign_lhs (stmt);
- else
- gcc_unreachable ();
-}
-
/* Propagate RHS into all uses of LHS (when possible).
RHS and LHS are derived from STMT, which is passed in solely so
@@ -186,7 +172,7 @@ propagate_rhs_into_lhs (gimple *stmt, tr
print_gimple_stmt (dump_file, use_stmt, 0, dump_flags);
}
- result = get_lhs_or_phi_result (use_stmt);
+ result = gimple_get_lhs (use_stmt);
bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
continue;
}
@@ -240,7 +226,7 @@ propagate_rhs_into_lhs (gimple *stmt, tr
&& (TREE_CODE (gimple_assign_rhs1 (use_stmt)) == SSA_NAME
|| is_gimple_min_invariant (gimple_assign_rhs1 (use_stmt))))
{
- tree result = get_lhs_or_phi_result (use_stmt);
+ tree result = gimple_get_lhs (use_stmt);
bitmap_set_bit (interesting_names, SSA_NAME_VERSION (result));
}
@@ -345,7 +331,7 @@ propagate_rhs_into_lhs (gimple *stmt, tr
eliminate_const_or_copy (gimple *stmt, bitmap interesting_names,
bitmap need_eh_cleanup)
{
- tree lhs = get_lhs_or_phi_result (stmt);
+ tree lhs = gimple_get_lhs (stmt);
tree rhs;
int version = SSA_NAME_VERSION (lhs);
bool cfg_altered = false;
===================================================================
@@ -1491,10 +1491,7 @@ eliminate_redundant_computations (gimple
gimple *stmt = gsi_stmt (*gsi);
- if (gimple_code (stmt) == GIMPLE_PHI)
- def = gimple_phi_result (stmt);
- else
- def = gimple_get_lhs (stmt);
+ def = gimple_get_lhs (stmt);
/* Certain expressions on the RHS can be optimized away, but can not
themselves be entered into the hash tables. */
===================================================================
@@ -236,11 +236,7 @@ avail_exprs_stack::lookup_avail_expr (gi
expr_hash_elt **slot;
tree lhs;
- /* Get LHS of phi, assignment, or call; else NULL_TREE. */
- if (gimple_code (stmt) == GIMPLE_PHI)
- lhs = gimple_phi_result (stmt);
- else
- lhs = gimple_get_lhs (stmt);
+ lhs = gimple_get_lhs (stmt);
class expr_hash_elt element (stmt, lhs);
===================================================================
@@ -7924,8 +7924,7 @@ vectorizable_live_operation (stmt_vec_in
/* Use the lhs of the original scalar statement. */
gimple *stmt = vect_orig_stmt (stmt_info)->stmt;
- lhs = (is_a <gphi *> (stmt)) ? gimple_phi_result (stmt)
- : gimple_get_lhs (stmt);
+ lhs = gimple_get_lhs (stmt);
lhs_type = TREE_TYPE (lhs);
bitsize = (VECTOR_BOOLEAN_TYPE_P (vectype)
@@ -7941,10 +7940,7 @@ vectorizable_live_operation (stmt_vec_in
/* Get the correct slp vectorized stmt. */
gimple *vec_stmt = SLP_TREE_VEC_STMTS (slp_node)[vec_entry]->stmt;
- if (gphi *phi = dyn_cast <gphi *> (vec_stmt))
- vec_lhs = gimple_phi_result (phi);
- else
- vec_lhs = gimple_get_lhs (vec_stmt);
+ vec_lhs = gimple_get_lhs (vec_stmt);
/* Get entry to use. */
bitstart = bitsize_int (vec_index);
===================================================================
@@ -3477,7 +3477,6 @@ vect_get_constant_vectors (tree op, slp_
static void
vect_get_slp_vect_defs (slp_tree slp_node, vec<tree> *vec_oprnds)
{
- tree vec_oprnd;
stmt_vec_info vec_def_stmt_info;
unsigned int i;
@@ -3486,11 +3485,7 @@ vect_get_slp_vect_defs (slp_tree slp_nod
FOR_EACH_VEC_ELT (SLP_TREE_VEC_STMTS (slp_node), i, vec_def_stmt_info)
{
gcc_assert (vec_def_stmt_info);
- if (gphi *vec_def_phi = dyn_cast <gphi *> (vec_def_stmt_info->stmt))
- vec_oprnd = gimple_phi_result (vec_def_phi);
- else
- vec_oprnd = gimple_get_lhs (vec_def_stmt_info->stmt);
- vec_oprnds->quick_push (vec_oprnd);
+ vec_oprnds->quick_push (gimple_get_lhs (vec_def_stmt_info->stmt));
}
}
@@ -3535,10 +3530,7 @@ vect_get_slp_defs (vec<tree> ops, slp_tr
stmt_vec_info related = STMT_VINFO_RELATED_STMT (first_def_info);
tree first_def_op;
- if (gphi *first_def = dyn_cast <gphi *> (first_def_info->stmt))
- first_def_op = gimple_phi_result (first_def);
- else
- first_def_op = gimple_get_lhs (first_def_info->stmt);
+ first_def_op = gimple_get_lhs (first_def_info->stmt);
if (operand_equal_p (oprnd, first_def_op, 0)
|| (related
&& operand_equal_p (oprnd,
===================================================================
@@ -1465,7 +1465,6 @@ vect_init_vector (stmt_vec_info stmt_inf
vect_get_vec_def_for_operand_1 (stmt_vec_info def_stmt_info,
enum vect_def_type dt)
{
- tree vec_oprnd;
stmt_vec_info vec_stmt_info;
switch (dt)
@@ -1488,11 +1487,7 @@ vect_get_vec_def_for_operand_1 (stmt_vec
vec_stmt_info = (STMT_VINFO_VEC_STMT
(STMT_VINFO_RELATED_STMT (def_stmt_info)));
gcc_assert (vec_stmt_info);
- if (gphi *phi = dyn_cast <gphi *> (vec_stmt_info->stmt))
- vec_oprnd = PHI_RESULT (phi);
- else
- vec_oprnd = gimple_get_lhs (vec_stmt_info->stmt);
- return vec_oprnd;
+ return gimple_get_lhs (vec_stmt_info->stmt);
}
/* operand is defined by a loop header phi. */
@@ -1505,11 +1500,7 @@ vect_get_vec_def_for_operand_1 (stmt_vec
/* Get the def from the vectorized stmt. */
vec_stmt_info = STMT_VINFO_VEC_STMT (def_stmt_info);
- if (gphi *phi = dyn_cast <gphi *> (vec_stmt_info->stmt))
- vec_oprnd = PHI_RESULT (phi);
- else
- vec_oprnd = gimple_get_lhs (vec_stmt_info->stmt);
- return vec_oprnd;
+ return gimple_get_lhs (vec_stmt_info->stmt);
}
default:
@@ -1642,11 +1633,7 @@ vect_get_vec_def_for_stmt_copy (vec_info
def_stmt_info = STMT_VINFO_RELATED_STMT (def_stmt_info);
gcc_assert (def_stmt_info);
- if (gphi *phi = dyn_cast <gphi *> (def_stmt_info->stmt))
- vec_oprnd = PHI_RESULT (phi);
- else
- vec_oprnd = gimple_get_lhs (def_stmt_info->stmt);
- return vec_oprnd;
+ return gimple_get_lhs (def_stmt_info->stmt);
}
@@ -9806,11 +9793,7 @@ vect_transform_stmt (stmt_vec_info stmt_
/* Find the relevant loop-exit phi-node, and reord the vec_stmt there
(to be used when vectorizing outer-loop stmts that use the DEF of
STMT). */
- if (gimple_code (stmt) == GIMPLE_PHI)
- scalar_dest = PHI_RESULT (stmt);
- else
- scalar_dest = gimple_get_lhs (stmt);
-
+ scalar_dest = gimple_get_lhs (stmt);
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
if (!flow_bb_inside_loop_p (innerloop, gimple_bb (USE_STMT (use_p))))
{