summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-distribution.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-04 10:55:25 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-04 10:55:25 +0000
commit616d052d46b0b972458af7c4db2c565bac93b470 (patch)
tree4de685c6f239c04550d50264c0cd2569faa2cb2c /gcc/tree-loop-distribution.c
parent35a1ce789de5614976b66c6ca793fe31d9408fcc (diff)
downloadgcc-616d052d46b0b972458af7c4db2c565bac93b470.tar.gz
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56837 * tree-loop-distribution.c (classify_partition): For non-zero values require that the value has the same precision as its mode to be useful as memset value. * g++.dg/torture/pr56837.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197476 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r--gcc/tree-loop-distribution.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 70f71b37c83..101efbed0a5 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -942,13 +942,17 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
gimple stmt = DR_STMT (single_store);
tree rhs = gimple_assign_rhs1 (stmt);
if (!(integer_zerop (rhs)
- || integer_all_onesp (rhs)
|| real_zerop (rhs)
|| (TREE_CODE (rhs) == CONSTRUCTOR
&& !TREE_CLOBBER_P (rhs))
- || (INTEGRAL_TYPE_P (TREE_TYPE (rhs))
- && (TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt)))
- == TYPE_MODE (unsigned_char_type_node)))))
+ || ((integer_all_onesp (rhs)
+ || (INTEGRAL_TYPE_P (TREE_TYPE (rhs))
+ && (TYPE_MODE (TREE_TYPE (rhs))
+ == TYPE_MODE (unsigned_char_type_node))))
+ /* For stores of a non-zero value require that the precision
+ of the value matches its actual size. */
+ && (TYPE_PRECISION (TREE_TYPE (rhs))
+ == GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (rhs)))))))
return;
if (TREE_CODE (rhs) == SSA_NAME
&& !SSA_NAME_IS_DEFAULT_DEF (rhs)