aboutsummaryrefslogtreecommitdiff
path: root/gcc/dce.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-01-17 09:04:28 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-01-17 09:04:28 +0100
commit9556b012b73024a95e72d8aa1b434ad50b8df9d3 (patch)
treebe2f15ccfc2d0ffd4a9a22d8734835dc1686e9b2 /gcc/dce.c
parent404fa41fcfba5b0f969e6845f0447a295c73984e (diff)
downloadgcc-9556b012b73024a95e72d8aa1b434ad50b8df9d3.zip
gcc-9556b012b73024a95e72d8aa1b434ad50b8df9d3.tar.gz
gcc-9556b012b73024a95e72d8aa1b434ad50b8df9d3.tar.bz2
re PR rtl-optimization/88870 (ICE: Segmentation fault (in df_worklist_propagate_backward))
PR rtl-optimization/88870 * dce.c (deletable_insn_p): Never delete const/pure calls that can throw if we can't alter the cfg or delete dead exceptions. (mark_insn): Don't call find_call_stack_args for such calls. * gcc.dg/pr88870.c: New test. From-SVN: r268008
Diffstat (limited to 'gcc/dce.c')
-rw-r--r--gcc/dce.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/dce.c b/gcc/dce.c
index ae8c478..7fd9c37 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -108,7 +108,10 @@ deletable_insn_p (rtx_insn *insn, bool fast, bitmap arg_stores)
/* We can delete dead const or pure calls as long as they do not
infinite loop. */
&& (RTL_CONST_OR_PURE_CALL_P (insn)
- && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)))
+ && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn))
+ /* Don't delete calls that may throw if we cannot do so. */
+ && ((cfun->can_delete_dead_exceptions && can_alter_cfg)
+ || insn_nothrow_p (insn)))
return find_call_stack_args (as_a <rtx_call_insn *> (insn), false,
fast, arg_stores);
@@ -201,7 +204,9 @@ mark_insn (rtx_insn *insn, bool fast)
&& !df_in_progress
&& !SIBLING_CALL_P (insn)
&& (RTL_CONST_OR_PURE_CALL_P (insn)
- && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)))
+ && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn))
+ && ((cfun->can_delete_dead_exceptions && can_alter_cfg)
+ || insn_nothrow_p (insn)))
find_call_stack_args (as_a <rtx_call_insn *> (insn), true, fast, NULL);
}
}