This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR66726] Factor conversion out of COND_EXPR
- From: Jeff Law <law at redhat dot com>
- To: Kugan <kugan dot vivekanandarajah at linaro dot org>, Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 10 Jul 2015 14:40:31 -0600
- Subject: Re: [PR66726] Factor conversion out of COND_EXPR
- Authentication-results: sourceware.org; auth=none
- References: <55974BF2 dot 3060603 at linaro dot org> <20150704085143 dot GA14895 at nbbrfq dot cc dot univie dot ac dot at> <5597D24B dot 8010900 at linaro dot org> <559AF515 dot 6010700 at redhat dot com> <559BCB15 dot 9010209 at linaro dot org> <559BE505 dot 5070802 at redhat dot com> <559EFEE5 dot 6030006 at linaro dot org>
On 07/09/2015 05:08 PM, Kugan wrote:
Done. Bootstrapped and regression tested on x86-64-none-linux-gnu with
no new regressions. Is this OK for trunk?
Thanks for the additional testcases.
+ else
+ {
+ /* If arg1 is an INTEGER_CST, fold it to new type. */
+ if (INTEGRAL_TYPE_P (TREE_TYPE (new_arg0))
+ && int_fits_type_p (arg1, TREE_TYPE (new_arg0)))
+ {
+ if (gimple_assign_cast_p (arg0_def_stmt))
+ new_arg1 = fold_convert (TREE_TYPE (new_arg0), arg1);
+ else
+ return false;
+ }
+ else
+ return false;
+ }
Something looks goofy here formatting-wise. Can you please check for
horizontal whitespace consistency before committing.
+
+ /* If types of new_arg0 and new_arg1 are different bailout. */
+ if (TREE_TYPE (new_arg0) != TREE_TYPE (new_arg1))
+ return false;
Seems like this should use types_compatible_p here. You're testing
pointer equality, but as long as the types are compatible, we should be
able to make the transformation.
With the horizontal whitespace fixed and using types_compatible_p this
is OK for the trunk. So pre-approved with those two changes and a final
bootstrap/regression test (due to the types_compatible_p change).
jeff