diff options
author | Richard Biener <rguenther@suse.de> | 2021-08-31 09:13:20 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-08-31 11:38:01 +0200 |
commit | 5e57bacf6f3599efea7634470db84121641c80b0 (patch) | |
tree | 931b4ea75778eaf33ec6f52abea8483852e7676f /gcc/tree-ssa-ter.c | |
parent | dd779c509e56d9300ceb03e3b009d5e0411380b8 (diff) | |
download | gcc-5e57bacf6f3599efea7634470db84121641c80b0.zip gcc-5e57bacf6f3599efea7634470db84121641c80b0.tar.gz gcc-5e57bacf6f3599efea7634470db84121641c80b0.tar.bz2 |
middle-end/102129 - avoid TER of possibly trapping expressions
The following avoids applying TER to possibly trapping expressions,
preventing a trapping FP multiplication to be moved across a call
that should not be executed.
2021-08-31 Richard Biener <rguenther@suse.de>
PR middle-end/102129
* tree-ssa-ter.c (find_replaceable_in_bb): Do not move
possibly trapping expressions across calls.
Diffstat (limited to 'gcc/tree-ssa-ter.c')
-rw-r--r-- | gcc/tree-ssa-ter.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c index 9eb8a11..3a057c2 100644 --- a/gcc/tree-ssa-ter.c +++ b/gcc/tree-ssa-ter.c @@ -658,11 +658,15 @@ find_replaceable_in_bb (temp_expr_table *tab, basic_block bb) substitution list, or the def and use span a call such that we'll expand lifetimes across a call. We also don't want to replace across these expressions that may call libcalls that - clobber the register involved. See PR 70184. */ + clobber the register involved. See PR 70184. Neither + do we want to move possibly trapping expressions across + a call. See PRs 102129 and 33593. */ if (gimple_has_volatile_ops (stmt) || same_root_var || (tab->call_cnt[ver] != cur_call_cnt - && SINGLE_SSA_USE_OPERAND (SSA_NAME_DEF_STMT (use), SSA_OP_USE) - == NULL_USE_OPERAND_P) + && (SINGLE_SSA_USE_OPERAND (SSA_NAME_DEF_STMT (use), + SSA_OP_USE) + == NULL_USE_OPERAND_P + || gimple_could_trap_p (SSA_NAME_DEF_STMT (use)))) || tab->reg_vars_cnt[ver] != cur_reg_vars_cnt) finished_with_expr (tab, ver, true); else |