]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix missed CSE with a BLKmode entity
authorRichard Biener <rguenther@suse.de>
Tue, 10 Oct 2023 09:09:16 +0000 (11:09 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 10 Oct 2023 10:35:53 +0000 (12:35 +0200)
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.

gcc/tree-ssa-sccvn.cc

index d2aab38c2d209d95c4aa8847a76863f12d0d3857..ce8ae8c675392e4cd632a4a30fffa5c2eb4d6018 100644 (file)
@@ -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
        {