Make sure checking code is conditional in VN
authorRichard Biener <rguenther@suse.de>
Fri, 1 Jul 2022 10:35:58 +0000 (12:35 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 1 Jul 2022 12:20:35 +0000 (14:20 +0200)
VN has checking code with gcc_unreachable (), the following makes
it cheaper by instead guarding the side-effect with flag_checking.

2022-07-01  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.cc (vn_nary_op_insert_into): Make
checking dominance check conditional on flag_checking.

gcc/tree-ssa-sccvn.cc

index 76d9289..c40c45e 100644 (file)
@@ -4243,9 +4243,10 @@ vn_nary_op_insert_into (vn_nary_op_t vno, vn_nary_op_table_type *table)
                      if (dominated_by_p (CDI_DOMINATORS, vno_bb, val_bb))
                        /* Value registered with more generic predicate.  */
                        return *slot;
-                     else if (dominated_by_p (CDI_DOMINATORS, val_bb, vno_bb))
+                     else if (flag_checking)
                        /* Shouldn't happen, we insert in RPO order.  */
-                       gcc_unreachable ();
+                       gcc_assert (!dominated_by_p (CDI_DOMINATORS,
+                                                    val_bb, vno_bb));
                    }
                  /* Append value.  */
                  *next = (vn_pval *) obstack_alloc (&vn_tables_obstack,