]> git.ipfire.org Git - thirdparty/gcc.git/commit
rtl-optimization/110939 Really fix narrow comparison of memory and constant
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Sun, 1 Oct 2023 14:11:32 +0000 (16:11 +0200)
committerStefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Sun, 1 Oct 2023 14:11:32 +0000 (16:11 +0200)
commit86b2ffc0b8334c86ed13974f7d986821040474a4
treec3c19eac440a0d9b5056d820f00b2d60665dc8a1
parente4a4b8e983bac865eb435b11798e38d633b98942
rtl-optimization/110939 Really fix narrow comparison of memory and constant

In the former fix in commit 41ef5a34161356817807be3a2e51fbdbe575ae85 I
completely missed the fact that the normal form of a CONST_INT for a
mode with fewer bits than in HOST_WIDE_INT is a sign extended version of
the actual constant.  This even holds true for unsigned constants.

Fixed by masking out the upper bits for the incoming constant and sign
extending the resulting unsigned constant.

gcc/ChangeLog:

* combine.cc (simplify_compare_const): Properly handle unsigned
constants while narrowing comparison of memory and constants.
gcc/combine.cc