The new DCE code inside of tree DSE removes in -fnon-call-exceptions
go code a load from NULL pointer the testcase relies on throwing an
exception and so the test hangs.
The following patch just repeats a check that e.g. tree-ssa-dce.c
uses to prevent this.
2021-05-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/100382
* tree-ssa-dse.c: Include tree-eh.h.
(dse_dom_walker::before_dom_children): Don't remove stmts if
stmt_unremovable_because_of_non_call_eh_p is true.
#include "builtins.h"
#include "gimple-fold.h"
#include "gimplify.h"
+#include "tree-eh.h"
/* This file implements dead store elimination.
/* When we remove dead stores make sure to also delete trivially
dead SSA defs. */
if (has_zero_uses (DEF_FROM_PTR (def_p))
- && !gimple_has_side_effects (stmt))
+ && !gimple_has_side_effects (stmt)
+ && !stmt_unremovable_because_of_non_call_eh_p (cfun, stmt))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{