DOM should follow VRP's lead and not attempt o assign global values to
SSA names when the branch leading to a __builtin_unreachable () has
2 ssa-names. Relations elsewhere may lead to this being invalid.
PR tree-optimization/125501
gcc/
* tree-ssa-dom.cc (set_global_ranges_from_unreachable_edges): Abort
if there are 2 SSA_NAMES on the branch condition.
gcc/testsuite/
* gcc.dg/pr125501.c: New.
--- /dev/null
+// { dg-do run }
+// { dg-options "-O3" }
+
+#include <stdint.h>
+int64_t g2, g27, g10;
+static void *g13, *g24;
+_Bool f11___trans_tmp_1, f11_c17;
+void __attribute__((noinline)) f11(int64_t a0, void *a4, void *a5)
+{
+ _Bool ob6;
+ int32_t v12;
+ int64_t v15;
+lbl_entry:
+lbl_sw_def4:
+ ob6 = g13 == a4;
+ if (ob6 || f11_c17) return;
+ if (f11___trans_tmp_1) v12 = g10;
+ a0 = (char *)a5 - (char *)a4;
+ ob6 = 0 == a0;
+ *(_Bool *)4 = 0;
+ if (ob6) goto lbl_b22;
+ __builtin_unreachable();
+lbl_b22:
+ g27 = v12;
+ switch (v15)
+ {
+ case 6009053803839173278: goto lbl_sw_def4;
+ case 70689892217558167: goto lbl_entry;
+ }
+}
+
+int main()
+{
+ f11(0, 0, g24);
+}
|| !assert_unreachable_fallthru_edge_p (pred_e))
return;
+ // Bail if the condition leading to the unreachable edge has 2 ssa-names.
+ // See PR 125501.
+ if ((TREE_CODE (gimple_cond_lhs (stmt)) == SSA_NAME
+ && TREE_CODE (gimple_cond_rhs (stmt)) == SSA_NAME))
+ return;
+
tree name;
FOR_EACH_GORI_EXPORT_NAME (m_ranger->gori_ssa (), pred_e->src, name)
if (all_uses_feed_or_dominated_by_stmt (name, stmt)