#include "gimple-range.h"
#include "value-range-storage.h"
#include "vr-values.h"
+#include "lto-streamer.h"
/* Function summary where the parameter infos are actually stored. */
ipa_node_params_t *ipa_node_params_sum = NULL;
if (jump_func->value.pass_through.operation != NOP_EXPR)
{
fprintf (f, " ");
- print_generic_expr (f, jump_func->value.pass_through.operand);
+ if (jump_func->value.pass_through.operand)
+ print_generic_expr (f, jump_func->value.pass_through.operand);
+ fprintf (f, " (in type ");
+ print_generic_expr (f, jump_func->value.pass_through.op_type);
+ fprintf (f, ")");
}
if (jump_func->value.pass_through.agg_preserved)
fprintf (f, ", agg_preserved");
if (item->value.pass_through.operation != NOP_EXPR)
{
fprintf (f, " ");
- print_generic_expr (f, item->value.pass_through.operand);
+ if (item->value.pass_through.operand)
+ print_generic_expr (f, item->value.pass_through.operand);
+ fprintf (f, " (in type ");
+ print_generic_expr (f, jump_func->value.pass_through.op_type);
+ fprintf (f, ")");
}
}
else if (item->jftype == IPA_JF_CONST)
{
jfunc->type = IPA_JF_PASS_THROUGH;
jfunc->value.pass_through.operand = NULL_TREE;
+ jfunc->value.pass_through.op_type = NULL_TREE;
jfunc->value.pass_through.formal_id = formal_id;
jfunc->value.pass_through.operation = NOP_EXPR;
jfunc->value.pass_through.agg_preserved = agg_preserved;
static void
ipa_set_jf_unary_pass_through (struct ipa_jump_func *jfunc, int formal_id,
- enum tree_code operation)
+ enum tree_code operation, tree op_type)
{
jfunc->type = IPA_JF_PASS_THROUGH;
jfunc->value.pass_through.operand = NULL_TREE;
+ jfunc->value.pass_through.op_type = op_type;
jfunc->value.pass_through.formal_id = formal_id;
jfunc->value.pass_through.operation = operation;
jfunc->value.pass_through.agg_preserved = false;
static void
ipa_set_jf_arith_pass_through (struct ipa_jump_func *jfunc, int formal_id,
- tree operand, enum tree_code operation)
+ tree operand, enum tree_code operation,
+ tree op_type)
{
jfunc->type = IPA_JF_PASS_THROUGH;
jfunc->value.pass_through.operand = unshare_expr_without_location (operand);
+ jfunc->value.pass_through.op_type = op_type;
jfunc->value.pass_through.formal_id = formal_id;
jfunc->value.pass_through.operation = operation;
jfunc->value.pass_through.agg_preserved = false;
if (index >= 0)
{
+ if (lto_variably_modified_type_p (TREE_TYPE (name)))
+ return;
+
switch (gimple_assign_rhs_class (stmt))
{
case GIMPLE_BINARY_RHS:
return;
ipa_set_jf_arith_pass_through (jfunc, index, op2,
- gimple_assign_rhs_code (stmt));
+ gimple_assign_rhs_code (stmt),
+ TREE_TYPE (name));
break;
}
case GIMPLE_SINGLE_RHS:
case GIMPLE_UNARY_RHS:
if (!CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt)))
ipa_set_jf_unary_pass_through (jfunc, index,
- gimple_assign_rhs_code (stmt));
+ gimple_assign_rhs_code (stmt),
+ TREE_TYPE (name));
default:;
}
return;
if (!is_gimple_assign (stmt))
break;
+ lhs = gimple_assign_lhs (stmt);
rhs1 = gimple_assign_rhs1 (stmt);
}
PASS-THROUGH jump function with ASSERT_EXPR operation whith operand 1
(the constant from the PHI node). */
- if (gimple_phi_num_args (phi) != 2)
+ if (gimple_phi_num_args (phi) != 2
+ || lto_variably_modified_type_p (TREE_TYPE (lhs)))
return;
tree arg0 = gimple_phi_arg_def (phi, 0);
tree arg1 = gimple_phi_arg_def (phi, 1);
code = ASSERT_EXPR;
agg_value->pass_through.operand = operand;
+ agg_value->pass_through.op_type = TREE_TYPE (lhs);
}
else if (is_gimple_assign (stmt))
{
with one operand, here we only allow tc_unary operation to avoid
possible problem. Then we can use (opclass == tc_unary) or not to
distinguish unary and binary. */
- if (TREE_CODE_CLASS (code) != tcc_unary || CONVERT_EXPR_CODE_P (code))
+ if (TREE_CODE_CLASS (code) != tcc_unary || CONVERT_EXPR_CODE_P (code)
+ || lto_variably_modified_type_p (TREE_TYPE (lhs)))
return;
rhs1 = get_ssa_def_if_simple_copy (rhs1, &stmt);
+ agg_value->pass_through.op_type = TREE_TYPE (lhs);
break;
case GIMPLE_BINARY_RHS:
gimple *rhs2_stmt = stmt;
tree rhs2 = gimple_assign_rhs2 (stmt);
+ if (lto_variably_modified_type_p (TREE_TYPE (lhs)))
+ return;
+
rhs1 = get_ssa_def_if_simple_copy (rhs1, &rhs1_stmt);
rhs2 = get_ssa_def_if_simple_copy (rhs2, &rhs2_stmt);
if (is_gimple_ip_invariant (rhs2))
{
agg_value->pass_through.operand = rhs2;
+ agg_value->pass_through.op_type = TREE_TYPE (lhs);
stmt = rhs1_stmt;
}
else if (is_gimple_ip_invariant (rhs1))
return;
agg_value->pass_through.operand = rhs1;
+ agg_value->pass_through.op_type = TREE_TYPE (lhs);
stmt = rhs2_stmt;
rhs1 = rhs2;
}
ipa_set_jf_simple_pass_through (dst, formal_id, agg_p);
}
else if (TREE_CODE_CLASS (operation) == tcc_unary)
- ipa_set_jf_unary_pass_through (dst, formal_id, operation);
+ {
+ tree op_t = ipa_get_jf_pass_through_op_type (src);
+ ipa_set_jf_unary_pass_through (dst, formal_id, operation,
+ op_t);
+ }
else
{
tree operand = ipa_get_jf_pass_through_operand (src);
+ tree op_t = ipa_get_jf_pass_through_op_type (src);
ipa_set_jf_arith_pass_through (dst, formal_id, operand,
- operation);
+ operation, op_t);
}
break;
}
}
else if (TREE_CODE_CLASS (jump_func->value.pass_through.operation)
== tcc_unary)
- streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id);
+ {
+ stream_write_tree (ob, jump_func->value.pass_through.op_type, true);
+ streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id);
+ }
else
{
+ stream_write_tree (ob, jump_func->value.pass_through.op_type, true);
stream_write_tree (ob, jump_func->value.pass_through.operand, true);
streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id);
}
case IPA_JF_LOAD_AGG:
streamer_write_uhwi (ob, item->value.pass_through.operation);
streamer_write_uhwi (ob, item->value.pass_through.formal_id);
+ if (item->value.pass_through.operation != NOP_EXPR)
+ stream_write_tree (ob, item->value.pass_through.op_type, true);
if (TREE_CODE_CLASS (item->value.pass_through.operation)
!= tcc_unary)
stream_write_tree (ob, item->value.pass_through.operand, true);
}
else if (TREE_CODE_CLASS (operation) == tcc_unary)
{
+ tree op_type = stream_read_tree (ib, data_in);
int formal_id = streamer_read_uhwi (ib);
- ipa_set_jf_unary_pass_through (jump_func, formal_id, operation);
+ ipa_set_jf_unary_pass_through (jump_func, formal_id, operation,
+ op_type);
}
else
{
+ tree op_type = stream_read_tree (ib, data_in);
tree operand = stream_read_tree (ib, data_in);
int formal_id = streamer_read_uhwi (ib);
ipa_set_jf_arith_pass_through (jump_func, formal_id, operand,
- operation);
+ operation, op_type);
}
break;
case IPA_JF_ANCESTOR:
operation = (enum tree_code) streamer_read_uhwi (ib);
item.value.pass_through.operation = operation;
item.value.pass_through.formal_id = streamer_read_uhwi (ib);
+ if (operation != NOP_EXPR)
+ item.value.pass_through.op_type = stream_read_tree (ib, data_in);
+ else
+ item.value.pass_through.op_type = NULL_TREE;
if (TREE_CODE_CLASS (operation) == tcc_unary)
item.value.pass_through.operand = NULL_TREE;
else
|| ipt1->formal_id != ipt2->formal_id
|| (!agg_jf && (ipt1->agg_preserved != ipt2->agg_preserved)))
return false;
+ if (ipt1->operation != NOP_EXPR
+ && (TYPE_MAIN_VARIANT (ipt1->op_type)
+ != TYPE_MAIN_VARIANT (ipt2->op_type)))
+ return false;
if (((ipt1->operand != NULL_TREE) != (ipt2->operand != NULL_TREE))
|| (ipt1->operand
&& !values_equal_for_ipcp_p (ipt1->operand, ipt2->operand)))