diff options
author | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2023-08-02 21:43:22 +0200 |
---|---|---|
committer | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2023-08-02 21:43:22 +0200 |
commit | 41ef5a34161356817807be3a2e51fbdbe575ae85 (patch) | |
tree | 33f177f85020d0c2baf7610892e3cc1ab698f1b4 /gcc/analyzer/analyzer-language.cc | |
parent | 1d5bc3285e8a115538442dc2aaa34d2b509e1f6e (diff) | |
download | gcc-41ef5a34161356817807be3a2e51fbdbe575ae85.zip gcc-41ef5a34161356817807be3a2e51fbdbe575ae85.tar.gz gcc-41ef5a34161356817807be3a2e51fbdbe575ae85.tar.bz2 |
rtl-optimization/110867 Fix narrow comparison of memory and constant
In certain cases a constant may not fit into the mode used to perform a
comparison. This may be the case for sign-extended constants which are
used during an unsigned comparison as e.g. in
(set (reg:CC 100 cc)
(compare:CC (mem:SI (reg/v/f:SI 115 [ a ]) [1 *a_4(D)+0 S4 A64])
(const_int -2147483648 [0xffffffff80000000])))
Fixed by ensuring that the constant fits into comparison mode.
Furthermore, on some targets as e.g. sparc the constant used in a
comparison is chopped off before combine which leads to failing test
cases (see PR 110869). Fixed by not requiring that the source mode has
to be DImode, and excluding sparc from the last two test cases entirely
since there the constant cannot be further reduced.
gcc/ChangeLog:
PR rtl-optimization/110867
* combine.cc (simplify_compare_const): Try the optimization only
in case the constant fits into the comparison mode.
gcc/testsuite/ChangeLog:
PR rtl-optimization/110869
* gcc.dg/cmp-mem-const-1.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-2.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-3.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-4.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-5.c: Exclude sparc since here the
constant is already reduced.
* gcc.dg/cmp-mem-const-6.c: Exclude sparc since here the
constant is already reduced.
Diffstat (limited to 'gcc/analyzer/analyzer-language.cc')
0 files changed, 0 insertions, 0 deletions