aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-07-12 07:11:50 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-07-12 07:11:50 +0000
commit9e392989053729d4d50681e1742e2920d3b08ee4 (patch)
tree90f7429c522f65ad7aba4fa7402f5684f598d6e5 /gcc/fold-const.c
parent19353855bfc05914faaee9f297684f608fd9a485 (diff)
downloadgcc-9e392989053729d4d50681e1742e2920d3b08ee4.zip
gcc-9e392989053729d4d50681e1742e2920d3b08ee4.tar.gz
gcc-9e392989053729d4d50681e1742e2920d3b08ee4.tar.bz2
re PR tree-optimization/86479 ([graphite] ICE in gimplify_modify_expr, at gimplify.c:5756)
2018-07-12 Richard Biener <rguenther@suse.de> PR middle-end/86479 * fold-const.c (fold_binary_op_with_conditional_arg): Do not move possibly trapping operations into the conditional. * gcc.dg/graphite/pr86479.c: New testcase. From-SVN: r262574
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 97c435f..ac65dcf 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6587,6 +6587,13 @@ fold_binary_op_with_conditional_arg (location_t loc,
tree rhs = NULL_TREE;
enum tree_code cond_code = COND_EXPR;
+ /* Do not move possibly trapping operations into the conditional as this
+ pessimizes code and causes gimplification issues when applied late. */
+ if (operation_could_trap_p (code, FLOAT_TYPE_P (type),
+ ANY_INTEGRAL_TYPE_P (type)
+ && TYPE_OVERFLOW_TRAPS (type), op1))
+ return NULL_TREE;
+
if (TREE_CODE (cond) == COND_EXPR
|| TREE_CODE (cond) == VEC_COND_EXPR)
{