> gcc/ChangeLog:
>
> 2024-11-01 Martin Jambor <[email protected]>
>
> * ipa-prop.cc (skip_a_conversion_op): New function.
> (ipa_compute_jump_functions_for_edge): Use it.
>
> gcc/testsuite/ChangeLog:
>
> 2024-11-01 Martin Jambor <[email protected]>
>
> * gcc.dg/ipa/vrp9.c: New test.
> ---
> gcc/ipa-prop.cc | 20 ++++++++++++++
> gcc/testsuite/gcc.dg/ipa/vrp9.c | 48 +++++++++++++++++++++++++++++++++
> 2 files changed, 68 insertions(+)
> create mode 100644 gcc/testsuite/gcc.dg/ipa/vrp9.c
>
> diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
> index db8eda8c361..9bd2e4bc60c 100644
> --- a/gcc/ipa-prop.cc
> +++ b/gcc/ipa-prop.cc
> @@ -2305,6 +2305,25 @@ ipa_set_jfunc_vr (ipa_jump_func *jf, const ipa_vr &vr)
> ipa_set_jfunc_vr (jf, tmp);
> }
>
> +
> +/* If T is an SSA_NAME that is a result of a simple type conversion
> statement,
> + return the operand of that conversion, otherwise treturn T. */
> +
> +static tree
> +skip_a_conversion_op (tree t)
> +{
> + if (TREE_CODE (t) != SSA_NAME
> + || SSA_NAME_IS_DEFAULT_DEF (t))
> + return t;
> +
> + gimple *def = SSA_NAME_DEF_STMT (t);
> + if (!is_gimple_assign (def)
> + || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def)))
> + return t;
I was wonderinf if we do not want to skip chains of conversions, but I
guess in the testcase:
void test(double);
void
test2(long double a)
{
test ((float)a);
}
We can skip float->double but not long double->float. The types stored
to summaries are known to match the types of parameters passed to the
funtion? I am kind of worried about hose implicit C conversions, like
float->double...
Honza