mirror of git://gcc.gnu.org/git/gcc.git
re PR middle-end/46647 (Can't inline memset with -1)
PR middle-end/46647 * builtins.c (fold_builtin_memset): Check c is INTEGER_CST instead of host_integerp check. Use TREE_INT_CST_LOW instead of tree_low_cst. * gcc.dg/pr46647.c: New test. From-SVN: r167170
This commit is contained in:
parent
fabd13b4a9
commit
f1b6918835
|
@ -1,5 +1,9 @@
|
||||||
2010-11-26 Jakub Jelinek <jakub@redhat.com>
|
2010-11-26 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/46647
|
||||||
|
* builtins.c (fold_builtin_memset): Check c is INTEGER_CST instead
|
||||||
|
of host_integerp check. Use TREE_INT_CST_LOW instead of tree_low_cst.
|
||||||
|
|
||||||
PR bootstrap/45700
|
PR bootstrap/45700
|
||||||
* tree.h (build1_stat_loc, build2_stat_loc, build3_stat_loc,
|
* tree.h (build1_stat_loc, build2_stat_loc, build3_stat_loc,
|
||||||
build4_stat_loc, build5_stat_loc, build6_stat_loc): New inlines.
|
build4_stat_loc, build5_stat_loc, build6_stat_loc): New inlines.
|
||||||
|
|
|
@ -8345,7 +8345,7 @@ fold_builtin_memset (location_t loc, tree dest, tree c, tree len,
|
||||||
if (integer_zerop (len))
|
if (integer_zerop (len))
|
||||||
return omit_one_operand_loc (loc, type, dest, c);
|
return omit_one_operand_loc (loc, type, dest, c);
|
||||||
|
|
||||||
if (! host_integerp (c, 1) || TREE_SIDE_EFFECTS (dest))
|
if (TREE_CODE (c) != INTEGER_CST || TREE_SIDE_EFFECTS (dest))
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
|
|
||||||
var = dest;
|
var = dest;
|
||||||
|
@ -8384,7 +8384,7 @@ fold_builtin_memset (location_t loc, tree dest, tree c, tree len,
|
||||||
if (CHAR_BIT != 8 || BITS_PER_UNIT != 8 || HOST_BITS_PER_WIDE_INT > 64)
|
if (CHAR_BIT != 8 || BITS_PER_UNIT != 8 || HOST_BITS_PER_WIDE_INT > 64)
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
|
|
||||||
cval = tree_low_cst (c, 1);
|
cval = TREE_INT_CST_LOW (c);
|
||||||
cval &= 0xff;
|
cval &= 0xff;
|
||||||
cval |= cval << 8;
|
cval |= cval << 8;
|
||||||
cval |= cval << 16;
|
cval |= cval << 16;
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2010-11-26 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/46647
|
||||||
|
* gcc.dg/pr46647.c: New test.
|
||||||
|
|
||||||
2010-11-25 Janus Weil <janus@gcc.gnu.org>
|
2010-11-25 Janus Weil <janus@gcc.gnu.org>
|
||||||
|
|
||||||
PR fortran/46581
|
PR fortran/46581
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* PR middle-end/46647 */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||||
|
|
||||||
|
int a;
|
||||||
|
|
||||||
|
int
|
||||||
|
func1 (void)
|
||||||
|
{
|
||||||
|
__builtin_memset (&a, -1, sizeof (a));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
func2 (void)
|
||||||
|
{
|
||||||
|
__builtin_memset (&a, 123, sizeof (a));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
func3 (void)
|
||||||
|
{
|
||||||
|
__builtin_memset (&a, 0, sizeof (a));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* { dg-final { scan-tree-dump-not "memset" "optimized" } } */
|
||||||
|
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
Loading…
Reference in New Issue