Add GSI_LAST_NEW_STMT iterator update
Currently when adding a sequence before there's no way to get the iterator placed at the last added stmt which results in convoluted code in the if-conversion usecase. The following adds GSI_LAST_NEW_STMT and corrects one obvious mistake in execute_update_addresses_taken as well as tries to avoid the just filed PR102726 by biasing the enum values to be outside of the boolean 0/1 range. 2021-10-13 Richard Biener <rguenther@suse.de> * gimple-iterator.h (gsi_iterator_update): Add GSI_LAST_NEW_STMT, start at integer value 2. * gimple-iterator.c (gsi_insert_seq_nodes_before): Update the iterator for GSI_LAST_NEW_STMT. (gsi_insert_seq_nodes_after): Likewise. * tree-if-conv.c (predicate_statements): Use GSI_LAST_NEW_STMT. * tree-ssa.c (execute_update_addresses_taken): Correct bogus arguments to gsi_replace.
This commit is contained in:
parent
e415bc4c03
commit
489c8f2729
|
@ -162,6 +162,9 @@ gsi_insert_seq_nodes_before (gimple_stmt_iterator *i,
|
|||
case GSI_CONTINUE_LINKING:
|
||||
i->ptr = first;
|
||||
break;
|
||||
case GSI_LAST_NEW_STMT:
|
||||
i->ptr = last;
|
||||
break;
|
||||
case GSI_SAME_STMT:
|
||||
break;
|
||||
default:
|
||||
|
@ -271,6 +274,7 @@ gsi_insert_seq_nodes_after (gimple_stmt_iterator *i,
|
|||
case GSI_NEW_STMT:
|
||||
i->ptr = first;
|
||||
break;
|
||||
case GSI_LAST_NEW_STMT:
|
||||
case GSI_CONTINUE_LINKING:
|
||||
i->ptr = last;
|
||||
break;
|
||||
|
|
|
@ -46,8 +46,8 @@ struct gphi_iterator : public gimple_stmt_iterator
|
|||
|
||||
enum gsi_iterator_update
|
||||
{
|
||||
GSI_NEW_STMT, /* Only valid when single statement is added, move
|
||||
iterator to it. */
|
||||
GSI_NEW_STMT = 2, /* Move the iterator to the first statement added. */
|
||||
GSI_LAST_NEW_STMT, /* Move the iterator to the last statement added. */
|
||||
GSI_SAME_STMT, /* Leave the iterator at the same statement. */
|
||||
GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
|
||||
for linking other statements in the same
|
||||
|
|
|
@ -2582,11 +2582,7 @@ predicate_statements (loop_p loop)
|
|||
{
|
||||
gsi_remove (&gsi, true);
|
||||
gsi_insert_seq_before (&gsi, rewrite_to_defined_overflow (stmt),
|
||||
GSI_SAME_STMT);
|
||||
if (gsi_end_p (gsi))
|
||||
gsi = gsi_last_bb (gimple_bb (stmt));
|
||||
else
|
||||
gsi_prev (&gsi);
|
||||
GSI_LAST_NEW_STMT);
|
||||
}
|
||||
else if (gimple_vdef (stmt))
|
||||
{
|
||||
|
|
|
@ -2079,7 +2079,7 @@ execute_update_addresses_taken (void)
|
|||
gcall *call
|
||||
= gimple_build_call_internal (IFN_ASAN_POISON, 0);
|
||||
gimple_call_set_lhs (call, var);
|
||||
gsi_replace (&gsi, call, GSI_SAME_STMT);
|
||||
gsi_replace (&gsi, call, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2088,7 +2088,7 @@ execute_update_addresses_taken (void)
|
|||
previous out of scope value. */
|
||||
tree clobber = build_clobber (TREE_TYPE (var));
|
||||
gimple *g = gimple_build_assign (var, clobber);
|
||||
gsi_replace (&gsi, g, GSI_SAME_STMT);
|
||||
gsi_replace (&gsi, g, true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue