aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-10-10 11:09:16 +0200
committerRichard Biener <rguenther@suse.de>2023-10-10 12:35:53 +0200
commit7c76c876e917a1f20a788f602cc78fff7d0a2a65 (patch)
tree6d9055784f29bbccbc5705ff7903dcb6e4ff2f4b
parent4d230493f57dd11b8de9155b03088092f2ecea5c (diff)
downloadgcc-7c76c876e917a1f20a788f602cc78fff7d0a2a65.zip
gcc-7c76c876e917a1f20a788f602cc78fff7d0a2a65.tar.gz
gcc-7c76c876e917a1f20a788f602cc78fff7d0a2a65.tar.bz2
Fix missed CSE with a BLKmode entity
The following fixes fallout of r10-7145-g1dc00a8ec9aeba which made us cautionous about CSEing a load to an object that has padding bits. The added check also triggers for BLKmode entities like STRING_CSTs but by definition a BLKmode entity does not have padding bits. PR tree-optimization/111751 * tree-ssa-sccvn.cc (visit_reference_op_load): Exempt BLKmode result from the padding bits check.
-rw-r--r--gcc/tree-ssa-sccvn.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index d2aab38..ce8ae8c 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -5747,8 +5747,9 @@ visit_reference_op_load (tree lhs, tree op, gimple *stmt)
{
/* Avoid the type punning in case the result mode has padding where
the op we lookup has not. */
- if (maybe_lt (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (result))),
- GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (op)))))
+ if (TYPE_MODE (TREE_TYPE (result)) != BLKmode
+ && maybe_lt (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (result))),
+ GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (op)))))
result = NULL_TREE;
else
{