return NULL_TREE;
}
-/* Return the result of a (possibly arithmetic) operation on the constant
- value INPUT. OPERAND is 2nd operand for binary operation. RES_TYPE is
- the type of the parameter to which the result is passed. Return
- NULL_TREE if that cannot be determined or be considered an
- interprocedural invariant. */
+/* Return the result of a (possibly arithmetic) operation on the constant value
+ INPUT. OPERAND is 2nd operand for binary operation. RES_TYPE is the type
+ in which any operation is to be performed. Return NULL_TREE if that cannot
+ be determined or be considered an interprocedural invariant. */
static tree
ipa_get_jf_arith_result (enum tree_code opcode, tree input, tree operand,
return res;
}
-/* Return the result of a (possibly arithmetic) pass through jump function
- JFUNC on the constant value INPUT. RES_TYPE is the type of the parameter
- to which the result is passed. Return NULL_TREE if that cannot be
- determined or be considered an interprocedural invariant. */
-
-static tree
-ipa_get_jf_pass_through_result (struct ipa_jump_func *jfunc, tree input,
- tree res_type)
-{
- return ipa_get_jf_arith_result (ipa_get_jf_pass_through_operation (jfunc),
- input,
- ipa_get_jf_pass_through_operand (jfunc),
- res_type);
-}
-
/* Return the result of an ancestor jump function JFUNC on the constant value
INPUT. Return NULL_TREE if that cannot be determined. */
return NULL_TREE;
if (jfunc->type == IPA_JF_PASS_THROUGH)
- return ipa_get_jf_pass_through_result (jfunc, input, parm_type);
+ {
+ if (!parm_type)
+ return NULL_TREE;
+ enum tree_code opcode = ipa_get_jf_pass_through_operation (jfunc);
+ tree op2 = ipa_get_jf_pass_through_operand (jfunc);
+ tree cstval = ipa_get_jf_arith_result (opcode, input, op2, NULL_TREE);
+ return ipacp_value_safe_for_type (parm_type, cstval);
+ }
else
return ipa_get_jf_ancestor_result (jfunc, input);
}
/* A helper function that returns result of operation specified by OPCODE on
the value of SRC_VAL. If non-NULL, OPND1_TYPE is expected type for the
value of SRC_VAL. If the operation is binary, OPND2 is a constant value
- acting as its second operand. If non-NULL, RES_TYPE is expected type of
- the result. */
+ acting as its second operand. */
static tree
get_val_across_arith_op (enum tree_code opcode,
tree opnd1_type,
tree opnd2,
- ipcp_value<tree> *src_val,
- tree res_type)
+ ipcp_value<tree> *src_val)
{
tree opnd1 = src_val->value;
&& !useless_type_conversion_p (opnd1_type, TREE_TYPE (opnd1)))
return NULL_TREE;
- return ipa_get_jf_arith_result (opcode, opnd1, opnd2, res_type);
+ return ipa_get_jf_arith_result (opcode, opnd1, opnd2, NULL_TREE);
}
/* Propagate values through an arithmetic transformation described by a jump
for (int j = 1; j < max_recursive_depth; j++)
{
tree cstval = get_val_across_arith_op (opcode, opnd1_type, opnd2,
- src_val, res_type);
+ src_val);
cstval = ipacp_value_safe_for_type (res_type, cstval);
if (!cstval)
break;
}
tree cstval = get_val_across_arith_op (opcode, opnd1_type, opnd2,
- src_val, res_type);
+ src_val);
cstval = ipacp_value_safe_for_type (res_type, cstval);
if (cstval)
ret |= dest_lat->add_value (cstval, cs, src_val, src_idx,
ipcp_lattice<tree> *dest_lat, int src_idx,
tree parm_type)
{
+ gcc_checking_assert (parm_type);
return propagate_vals_across_arith_jfunc (cs,
ipa_get_jf_pass_through_operation (jfunc),
NULL_TREE,