diff options
author | Richard Biener <rguenther@suse.de> | 2018-07-12 07:11:50 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-07-12 07:11:50 +0000 |
commit | 9e392989053729d4d50681e1742e2920d3b08ee4 (patch) | |
tree | 90f7429c522f65ad7aba4fa7402f5684f598d6e5 /gcc | |
parent | 19353855bfc05914faaee9f297684f608fd9a485 (diff) | |
download | gcc-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')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/pr86479.c | 39 |
4 files changed, 57 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8a6586..c36a8a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 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. + +2018-07-12 Richard Biener <rguenther@suse.de> + * tree-ssa-sccvn.c (mprts_hook_cnt): Remove. (vn_lookup_simplify_result): Remove recursion limit applied here. 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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e8df3b6..0958a1a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-07-12 Richard Biener <rguenther@suse.de> + + PR middle-end/86479 + * gcc.dg/graphite/pr86479.c: New testcase. + 2018-07-11 Jakub Jelinek <jakub@redhat.com> * gcc.target/i386/avx512bw-vpcmpb-2.c (CMP): Use SIZE macro instead diff --git a/gcc/testsuite/gcc.dg/graphite/pr86479.c b/gcc/testsuite/gcc.dg/graphite/pr86479.c new file mode 100644 index 0000000..7df6354 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr86479.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-nest-optimize -fnon-call-exceptions -fno-guess-branch-probability -fno-tree-loop-im" } */ + +__INTPTR_TYPE__ uf; + +void +m7 (__INTPTR_TYPE__ *aw, __INTPTR_TYPE__ ws) +{ + __INTPTR_TYPE__ *e5 = &ws; + + if (ws < 1) + { + int cq = 0; + + while (cq < 1) + { + int *ng; + int *ud; + + *e5 *= uf < 0; + + for (*ng = 0; *ng < 2; ++*ng) + { + } + + ws /= cq; + *aw *= ws; + + for (*ud = 0; *ud < 2; ++*ud) + { + } + } + } + + if (ws < 2) + e5 = &uf; + + *e5 = 0; +} |