This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][4.1/4.2] Fix PR27260, fallout of fix for PR27095
On Wed, Apr 26, 2006 at 09:09:53PM -0600, Roger Sayle wrote:
> Perhaps its a sign of my age, but I'm cautious about removing the
> builtin_save_expr calls from builtins.c. You might be right that
> with the current tree-ssa infrastructure SAVE_EXPRs are much rarer,
> but I worry that the process of RTL expansion and the recursive
> nature of builtin expansion may introduce SAVE_EXPRs that we didn't
> anticipate.
Perhaps so. In fact, I do know that SAVE_EXPRs can be found in arg
trees, from split_complex_values, but of course this isn't relevant to
expand_builtin_memset. Whether the split_complex_values' SAVE_EXPRs can
cause trouble when expand_call expands the args multiple times for
sibling, tail, and normal calls is something I haven't investigated
yet..
> - tree cval;
> rtx val_rtx;
>
> - cval = fold_build1 (CONVERT_EXPR, unsigned_char_type_node, val);
> val_rtx = expand_normal (cval);
> ---
> rtx val_rtx = expand_normal (val);
> val_rtx = convert_to_mode (QImode, val_rtx, 1);
>
> I'm not sure if its safe to use QImode directly here, perhaps its
> better to use TYPE_MODE (unsigned_char_type_node) instead? Yep,
> that idiom is used a few lines further down.
Funny enough, I bootstrapped the following before I looked at removing
the SAVE_EXPRs. It differs from what you suggest in the last arg to
convert_to_mode. I believe 0 is correct, because the unsignedp
parameter is referring to val_rtx, which we know to be int, ie. signed.
PR middle-end/27260
* builtins.c (expand_builtin_memset): Expand val in original mode.
OK to apply?
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c (revision 113295)
+++ gcc/builtins.c (working copy)
@@ -3421,11 +3421,11 @@ expand_builtin_memset (tree arglist, rtx
if (TREE_CODE (val) != INTEGER_CST)
{
- tree cval;
rtx val_rtx;
- cval = fold_build1 (CONVERT_EXPR, unsigned_char_type_node, val);
- val_rtx = expand_normal (cval);
+ val_rtx = expand_normal (val);
+ val_rtx = convert_to_mode (TYPE_MODE (unsigned_char_type_node),
+ val_rtx, 0);
/* Assume that we can memset by pieces if we can store the
* the coefficients by pieces (in the required modes).
--
Alan Modra
IBM OzLabs - Linux Technology Centre