{
tree stmt = tsi_stmt (oi);
if (TREE_CODE (stmt) == STATEMENT_LIST)
+ /* This copy is not redundant; tsi_link_after will smash this
+ STATEMENT_LIST into the end of the one we're building, and we
+ don't want to do that with the original. */
copy_statement_list (&stmt);
tsi_link_after (&ni, stmt, TSI_CONTINUE_LINKING);
}
{
/* Otherwise, just copy the node. Note that copy_tree_r already
knows not to copy VAR_DECLs, etc., so this is safe. */
+
+ /* We should never have TREE_BLOCK set on non-statements. */
+ if (EXPR_P (*tp))
+ gcc_assert (!TREE_BLOCK (*tp));
+
if (TREE_CODE (*tp) == MEM_REF)
{
tree ptr = TREE_OPERAND (*tp, 0);
+ tree type = remap_type (TREE_TYPE (*tp), id);
tree old = *tp;
tree tem;
if ((tem = maybe_fold_offset_to_reference (EXPR_LOCATION (*tp),
ptr,
TREE_OPERAND (*tp, 1),
- TREE_TYPE (*tp)))
+ type))
&& TREE_THIS_VOLATILE (tem) == TREE_THIS_VOLATILE (old))
{
tree *tem_basep = &tem;
}
else
{
- *tp = fold_build2 (MEM_REF, TREE_TYPE (*tp),
+ *tp = fold_build2 (MEM_REF, type,
ptr, TREE_OPERAND (*tp, 1));
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
tweak some special cases. */
copy_tree_r (tp, walk_subtrees, NULL);
+ if (TREE_CODE (*tp) != OMP_CLAUSE)
+ TREE_TYPE (*tp) = remap_type (TREE_TYPE (*tp), id);
+
/* Global variables we haven't seen yet need to go into referenced
vars. If not referenced from types only. */
if (gimple_in_ssa_p (cfun)
&& !processing_debug_stmt)
add_referenced_var (*tp);
- /* We should never have TREE_BLOCK set on non-statements. */
- if (EXPR_P (*tp))
- gcc_assert (!TREE_BLOCK (*tp));
-
- if (TREE_CODE (*tp) != OMP_CLAUSE)
- TREE_TYPE (*tp) = remap_type (TREE_TYPE (*tp), id);
-
if (TREE_CODE (*tp) == TARGET_EXPR && TREE_OPERAND (*tp, 3))
{
/* The copied TARGET_EXPR has never been expanded, even if the
*tp = new_tree;
}
else if (code == STATEMENT_LIST)
- {
- /* We used to just abort on STATEMENT_LIST, but we can run into them
- with statement-expressions (c++/40975). */
- tree new_list = alloc_stmt_list ();
- tree_stmt_iterator i = tsi_start (*tp);
- tree_stmt_iterator j = tsi_last (new_list);
- for (; !tsi_end_p (i); tsi_next (&i))
- {
- tree stmt = tsi_stmt (i);
- tsi_link_after (&j, stmt, TSI_CONTINUE_LINKING);
- }
- *tp = new_list;
- }
+ /* We used to just abort on STATEMENT_LIST, but we can run into them
+ with statement-expressions (c++/40975). */
+ copy_statement_list (tp);
else if (TREE_CODE_CLASS (code) == tcc_type)
*walk_subtrees = 0;
else if (TREE_CODE_CLASS (code) == tcc_declaration)
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_new_cfg = false;
id.transform_return_to_modify = true;
- id.transform_lang_insert_block = false;
+ id.transform_lang_insert_block = NULL;
/* Make sure not to unshare trees behind the front-end's back
since front-end specific mechanisms may rely on sharing. */