diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-02-26 10:08:45 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-02-26 10:09:21 +0100 |
commit | 24aa051af7c59f37ec45aea754b48b97d210ea6d (patch) | |
tree | 0fb4c9002b4ab93d7a90f068d7ffcbcccd113cd6 /gcc/tree-vect-loop-manip.cc | |
parent | f9d2a95be5680e04f53141c2675798b06d23f409 (diff) | |
download | gcc-24aa051af7c59f37ec45aea754b48b97d210ea6d.zip gcc-24aa051af7c59f37ec45aea754b48b97d210ea6d.tar.gz gcc-24aa051af7c59f37ec45aea754b48b97d210ea6d.tar.bz2 |
match.pd: Guard 2 simplifications on integral TYPE_OVERFLOW_UNDEFINED [PR114090]
These 2 patterns are incorrect on floating point, or for -fwrapv, or
for -ftrapv, or the first one for unsigned types (the second one is
mathematically correct, but we ought to just fold that to 0 instead).
So, the following patch properly guards this.
I think we don't need && !TYPE_OVERFLOW_SANITIZED (type) because
in both simplifications there would be UB before and after on
signed integer minimum.
2024-02-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/114090
* match.pd ((x >= 0 ? x : 0) + (x <= 0 ? -x : 0) -> abs x):
Restrict pattern to ANY_INTEGRAL_TYPE_P and TYPE_OVERFLOW_UNDEFINED
types.
((x <= 0 ? -x : 0) -> max(-x, 0)): Likewise.
* gcc.dg/pr114090.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
0 files changed, 0 insertions, 0 deletions