}
/* Inspect all uses of NAME and simple arithmetic calculations involving NAME
- in NODE and return a negative number if any of them is used for something
- else than either an actual call argument, simple arithmetic operation or
- debug statement. If there are no such uses, return the number of actual
- arguments that this parameter eventually feeds to (or zero if there is none).
- For any such parameter, mark PARM_NUM as one of its sources. ANALYZED is a
- bitmap that tracks which SSA names we have already started
- investigating. */
+ in FUN represented with NODE and return a negative number if any of them is
+ used for something else than either an actual call argument, simple
+ arithmetic operation or debug statement. If there are no such uses, return
+ the number of actual arguments that this parameter eventually feeds to (or
+ zero if there is none). For any such parameter, mark PARM_NUM as one of its
+ sources. ANALYZED is a bitmap that tracks which SSA names we have already
+ started investigating. */
static int
-isra_track_scalar_value_uses (cgraph_node *node, tree name, int parm_num,
- bitmap analyzed)
+isra_track_scalar_value_uses (function *fun, cgraph_node *node, tree name,
+ int parm_num, bitmap analyzed)
{
int res = 0;
imm_use_iterator imm_iter;
}
res += all_uses;
}
- else if ((is_gimple_assign (stmt) && !gimple_has_volatile_ops (stmt))
- || gimple_code (stmt) == GIMPLE_PHI)
+ else if (!stmt_unremovable_because_of_non_call_eh_p (fun, stmt)
+ && ((is_gimple_assign (stmt) && !gimple_has_volatile_ops (stmt))
+ || gimple_code (stmt) == GIMPLE_PHI))
{
tree lhs;
if (gimple_code (stmt) == GIMPLE_PHI)
gcc_assert (!gimple_vdef (stmt));
if (bitmap_set_bit (analyzed, SSA_NAME_VERSION (lhs)))
{
- int tmp = isra_track_scalar_value_uses (node, lhs, parm_num,
+ int tmp = isra_track_scalar_value_uses (fun, node, lhs, parm_num,
analyzed);
if (tmp < 0)
{
return true;
bitmap analyzed = BITMAP_ALLOC (NULL);
- int call_uses = isra_track_scalar_value_uses (node, name, parm_num, analyzed);
+ int call_uses = isra_track_scalar_value_uses (fun, node, name, parm_num,
+ analyzed);
BITMAP_FREE (analyzed);
if (call_uses < 0)
return true;
}
}
+/* Return true if STMT in function FUN must be assumed necessary because of
+ non-call exceptions. */
+
+bool
+stmt_unremovable_because_of_non_call_eh_p (function *fun, gimple *stmt)
+{
+ return (fun->can_throw_non_call_exceptions
+ && !fun->can_delete_dead_exceptions
+ && stmt_could_throw_p (fun, stmt));
+}
/* Return true if expression T could throw an exception. */
extern bool tree_could_trap_p (tree);
extern tree rewrite_to_non_trapping_overflow (tree);
extern bool stmt_could_throw_p (function *, gimple *);
+extern bool stmt_unremovable_because_of_non_call_eh_p (function *, gimple *);
extern bool tree_could_throw_p (tree);
extern bool stmt_can_throw_external (function *, gimple *);
extern bool stmt_can_throw_internal (function *, gimple *);
{
/* With non-call exceptions, we have to assume that all statements could
throw. If a statement could throw, it can be deemed necessary. */
- if (cfun->can_throw_non_call_exceptions
- && !cfun->can_delete_dead_exceptions
- && stmt_could_throw_p (cfun, stmt))
+ if (stmt_unremovable_because_of_non_call_eh_p (cfun, stmt))
{
mark_stmt_necessary (stmt, true);
return;