public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-9413] tree-optimization/109491 - ICE in expressions_equal_p
@ 2023-04-17  9:14 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-04-17  9:14 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ba02c6706cc502ee64b9c5d32b08409c44fe967d

commit r12-9413-gba02c6706cc502ee64b9c5d32b08409c44fe967d
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 13 14:09:30 2023 +0200

    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.
    
    (cherry picked from commit a37783de23c067d6a26374ff29c014e49604035c)

Diff:
---
 gcc/tree-ssa-sccvn.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index a63f5c8c307..cda03e0aa68 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -6034,6 +6034,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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-17  9:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17  9:14 [gcc r12-9413] tree-optimization/109491 - ICE in expressions_equal_p Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).