diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2024-09-19 13:50:14 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2024-09-25 08:03:18 -0700 |
commit | 6c5543d3d9c4bbcd19f0ae2b7ed7e523c978a9a8 (patch) | |
tree | aad71a5a80ec8fec08fc8d7aab6ef44a3657cffd /gcc/tree-vectorizer.h | |
parent | 7cf85d137ba8f83a54438f53f557225485c3f695 (diff) | |
download | gcc-6c5543d3d9c4bbcd19f0ae2b7ed7e523c978a9a8.zip gcc-6c5543d3d9c4bbcd19f0ae2b7ed7e523c978a9a8.tar.gz gcc-6c5543d3d9c4bbcd19f0ae2b7ed7e523c978a9a8.tar.bz2 |
match: Fix `a != 0 ? a * b : 0` patterns for things that trap [PR116772]
For generic, `a != 0 ? a * b : 0` would match where `b` would be an expression
which trap (in the case of the testcase, it was an integer division but it could be any).
This adds a new helper function, expr_no_side_effects_p which tests if there is no side effects
and the expression is not trapping which might be used in other locations.
Changes since v1:
* v2: Add move check to helper function instead of inlining it.
PR middle-end/116772
gcc/ChangeLog:
* generic-match-head.cc (expr_no_side_effects_p): New function
* gimple-match-head.cc (expr_no_side_effects_p): New function
* match.pd (`a != 0 ? a / b : 0`): Check expr_no_side_effects_p.
(`a != 0 ? a * b : 0`, `a != 0 ? a & b : 0`): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr116772-1.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions