diff options
author | Richard Biener <rguenther@suse.de> | 2023-04-13 14:09:30 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-04-13 14:09:30 +0200 |
commit | a37783de23c067d6a26374ff29c014e49604035c (patch) | |
tree | 7c4bb982252f25d8007925d0c6620bdf61c4db63 | |
parent | 66c7257b675068fe62505d74873371fd0508b499 (diff) | |
download | gcc-a37783de23c067d6a26374ff29c014e49604035c.zip gcc-a37783de23c067d6a26374ff29c014e49604035c.tar.gz gcc-a37783de23c067d6a26374ff29c014e49604035c.tar.bz2 |
tree-optimization/109491 - ICE in expressions_equal_p
At some point I elided the NULL pointer check in expressions_equal_p
because it shouldn't be necessary not realizing that for example
TARGET_MEM_REF has optional operands we cannot substitute with
something non-NULL with the same semantics. The following does the
simple thing and restore the check removed in r11-4982.
PR tree-optimization/109491
* tree-ssa-sccvn.cc (expressions_equal_p): Restore the
NULL operands test.
-rw-r--r-- | gcc/tree-ssa-sccvn.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 9960953..9692911 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -6407,6 +6407,13 @@ expressions_equal_p (tree e1, tree e2, bool match_vn_top_optimistically) && (e1 == VN_TOP || e2 == VN_TOP)) return true; + /* If only one of them is null, they cannot be equal. While in general + this should not happen for operations like TARGET_MEM_REF some + operands are optional and an identity value we could substitute + has differing semantics. */ + if (!e1 || !e2) + return false; + /* SSA_NAME compare pointer equal. */ if (TREE_CODE (e1) == SSA_NAME || TREE_CODE (e2) == SSA_NAME) return false; |