This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ICE in re-simplification of VEC_COND_EXPR (was: Re: [PATCH][amdgcn] Fix ICE in re-simplification of VEC_COND_EXPR)
- From: "Harwath, Frederik" <frederik at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Richard Sandiford <richard dot sandiford at arm dot com>, Ilya Leoshkevich <iii at linux dot ibm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "Stubbs, Andrew" <ams at codesourcery dot com>, <kcy at codesourcery dot com>
- Date: Fri, 29 Nov 2019 14:56:22 +0100
- Subject: Re: [PATCH] Fix ICE in re-simplification of VEC_COND_EXPR (was: Re: [PATCH][amdgcn] Fix ICE in re-simplification of VEC_COND_EXPR)
- Ironport-sdr: XGFsQHrOdMeDkSSK/KUhCSw+ZQgFF478i+hjqGGDmwwLaHlK89nzS/diwXlvF78XeTKXEakK15 ArwT5790rnGzQt6y0S4G4yopP5S/GDju14Tt4H23aslK+JZb76p8aHg7GP/rZ1p+MPlG+SZliG BBJW3KX8ZcoSEMZDHfBOqe2xu5ROQJVXyalLx4I0C5tdOSrEet2Dk/INnW/u0mLTZdyCstmmuw XA7o/LCfgVkxkxHgvVnX5UkHoKAjx2E+AX4sXNUR12cJZuJbPBjNqjrd/SBThQFc9G92fxsk2D ef8=
- Ironport-sdr: RjkO27HYCLquarFkJ0aLZTSfJYbzNQljEzXszqbrV+wqley1bV+jud1eKArgYYbz7nWSFvCC6/ FNqPGgdUg0UyQWvaZ6YJGSCtJv/zNnLMMNVW9SUI5KVz4K+NmRUIcGyjij5i0VxpLb78g/Cvt0 k7LLwxUI27VkMLxIWs0Dx7eElj4AsFFomSQ4OhLltC2bc4TUCieZWwxzoDIcaB6qmWWEBi8Gn9 RDiYYG3PvtwNaZC2YbYznRkjoiHEknsl/dVuAlyJkr7fPW+KyanxTxUjmCJahxY36nS4VKvUL3 pRc=
- References: <643ae1a0-ffa2-2004-d186-736c81c6a0d7@codesourcery.com> <CAFiYyc2+KNdYpH+T3TDpHnSmidQaF+TZsPstS-mGdUtK8LrK3w@mail.gmail.com> <15f42d15-a39e-c221-d041-acb9928ed3ac@codesourcery.com> <73fbd025-06d0-0641-00e2-a47bd8879e6a@codesourcery.com> <20191129134152.GL10088@tucnak>
Hi Jakub,
On 29.11.19 14:41, Jakub Jelinek wrote:
> s/use/Use/
>
> [...]
>
> s/. /. /
Right, thanks. Does that look ok for inclusion in trunk now?
Best regards,
Frederik
2019-11-29 Frederik Harwath <frederik@codesourcery.com>
gcc/
* gimple-match-head.c (maybe_resimplify_conditional_op): Use
generic_expr_could_trap_p to check if the condition of COND_EXPR or
VEC_COND_EXPR can trap.
---
gcc/gimple-match-head.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
index 2996bade301..9010f11621e 100644
--- a/gcc/gimple-match-head.c
+++ b/gcc/gimple-match-head.c
@@ -144,9 +144,21 @@ maybe_resimplify_conditional_op (gimple_seq *seq, gimple_match_op *res_op,
/* Likewise if the operation would not trap. */
bool honor_trapv = (INTEGRAL_TYPE_P (res_op->type)
&& TYPE_OVERFLOW_TRAPS (res_op->type));
- if (!operation_could_trap_p ((tree_code) res_op->code,
- FLOAT_TYPE_P (res_op->type),
- honor_trapv, res_op->op_or_null (1)))
+ tree_code op_code = (tree_code) res_op->code;
+ bool op_could_trap;
+
+ /* COND_EXPR and VEC_COND_EXPR will trap if, and only if, the condition
+ traps and hence we have to check this. For all other operations, we
+ don't need to consider the operands. */
+ if (op_code == COND_EXPR || op_code == VEC_COND_EXPR)
+ op_could_trap = generic_expr_could_trap_p (res_op->ops[0]);
+ else
+ op_could_trap = operation_could_trap_p ((tree_code) res_op->code,
+ FLOAT_TYPE_P (res_op->type),
+ honor_trapv,
+ res_op->op_or_null (1));
+
+ if (!op_could_trap)
{
res_op->cond.cond = NULL_TREE;
return false;
--
2.17.1