@@ -238,6 +238,7 @@ insert_check_and_trap (location_t loc, gimple_stmt_iterator *gsip,
gimple_stmt_iterator gsit = gsi_after_labels (trp);
gcall *trap = gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0);
+ gimple_call_set_ctrl_altering (trap, true);
gimple_set_location (trap, loc);
gsi_insert_before (&gsit, trap, GSI_SAME_STMT);
@@ -440,6 +440,7 @@ gimple_build_builtin_unreachable (location_t loc)
gcc_checking_assert (data == NULL_TREE);
g = gimple_build_call_internal (IFN_TRAP, 0);
}
+ gimple_call_set_ctrl_altering (g, true);
gimple_set_location (g, loc);
return g;
}
@@ -635,6 +635,7 @@ expand_thunk (cgraph_node *node, bool output_asm_thunks,
}
else
{
+ gimple_call_set_ctrl_altering (call, true);
gimple_call_set_tail (call, true);
cfun->tail_call_marked = true;
remove_edge (single_succ_edge (bb));
@@ -821,8 +821,9 @@ handle_abnormal_edges (basic_block *dispatcher_bbs, basic_block for_bb,
else
{
tree arg = inner ? boolean_true_node : boolean_false_node;
- gimple *g = gimple_build_call_internal (IFN_ABNORMAL_DISPATCHER,
+ gcall *g = gimple_build_call_internal (IFN_ABNORMAL_DISPATCHER,
1, arg);
+ gimple_call_set_ctrl_altering (g, true);
gimple_stmt_iterator gsi = gsi_after_labels (*dispatcher);
gsi_insert_after (&gsi, g, GSI_NEW_STMT);
@@ -220,9 +220,10 @@ cleanup_call_ctrl_altering_flag (basic_block bb, gimple *bb_end)
return;
int flags = gimple_call_flags (bb_end);
- if (((flags & (ECF_CONST | ECF_PURE))
- && !(flags & ECF_LOOPING_CONST_OR_PURE))
- || (flags & ECF_LEAF))
+ if (!(flags & ECF_NORETURN)
+ && (((flags & (ECF_CONST | ECF_PURE))
+ && !(flags & ECF_LOOPING_CONST_OR_PURE))
+ || (flags & ECF_LEAF)))
gimple_call_set_ctrl_altering (bb_end, false);
else
{
@@ -328,6 +329,10 @@ cleanup_control_flow_bb (basic_block bb)
gsi_remove (&gsi, true);
if (remove_fallthru_edge (bb->succs))
retval = true;
+ tree lhs = gimple_call_lhs (stmt);
+ if (!lhs
+ || !should_remove_lhs_p (lhs))
+ gimple_call_set_ctrl_altering (stmt, true);
}
return retval;
@@ -3321,7 +3321,7 @@ lower_resx (basic_block bb, gresx *stmt,
int lp_nr;
eh_region src_r, dst_r;
gimple_stmt_iterator gsi;
- gimple *x;
+ gcall *x;
tree fn, src_nr;
bool ret = false;
@@ -3346,6 +3346,7 @@ lower_resx (basic_block bb, gresx *stmt,
fn = builtin_decl_implicit (BUILT_IN_TRAP);
x = gimple_build_call (fn, 0);
+ gimple_call_set_ctrl_altering (x, true);
gsi_insert_before (&gsi, x, GSI_SAME_STMT);
while (EDGE_COUNT (bb->succs) > 0)
@@ -3463,6 +3464,7 @@ lower_resx (basic_block bb, gresx *stmt,
fn = builtin_decl_implicit (BUILT_IN_UNWIND_RESUME);
x = gimple_build_call (fn, 1, var);
+ gimple_call_set_ctrl_altering (x, true);
gsi_insert_before (&gsi, x, GSI_SAME_STMT);
}