diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-06-21 11:40:16 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-06-21 11:40:16 +0200 |
commit | a0c30fe3b888f20215f3e040d21b62b603804ca9 (patch) | |
tree | b398354964de91afb6a9b2cd2078b247699c18bd /ylwrap | |
parent | 2df1df945fac85d7b3d084001414a66a2709d8fe (diff) | |
download | gcc-a0c30fe3b888f20215f3e040d21b62b603804ca9.zip gcc-a0c30fe3b888f20215f3e040d21b62b603804ca9.tar.gz gcc-a0c30fe3b888f20215f3e040d21b62b603804ca9.tar.bz2 |
ifcvt: Don't introduce trapping or faulting reads in noce_try_sign_mask [PR106032]
noce_try_sign_mask as documented will optimize
if (c < 0)
x = t;
else
x = 0;
into x = (c >> bitsm1) & t;
The optimization is done if either t is unconditional
(e.g. for
x = t;
if (c >= 0)
x = 0;
) or if it is cheap. We already check that t doesn't have side-effects,
but if t is conditional, we need to punt also if it may trap or fault,
as we make it unconditional.
I've briefly skimmed other noce_try* optimizations and didn't find one that
would suffer from the same problem.
2022-06-21 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/106032
* ifcvt.cc (noce_try_sign_mask): Punt if !t_unconditional, and
t may_trap_or_fault_p, even if it is cheap.
* gcc.c-torture/execute/pr106032.c: New test.
Diffstat (limited to 'ylwrap')
0 files changed, 0 insertions, 0 deletions