RFR: 8322758: Eliminate -Wparentheses warnings in C2 code [v2]

Kim Barrett kbarrett at openjdk.org
Tue Jan 2 22:27:02 UTC 2024


On Fri, 29 Dec 2023 18:21:26 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   update copyrights for 2024
>
> Marked as reviewed by aph (Reviewer).

Thanks for reviews @theRealAph and @vnkozlov .

> src/hotspot/share/opto/loopPredicate.cpp line 801:
> 
>> 799:   const TypeInt* idx_type = TypeInt::INT;
>> 800:   // same signs and upper, or different signs and not upper.
>> 801:   if (((stride > 0) == (scale > 0)) == upper) {
> 
> This is rather l33t code, but I guess it's OK with the comment. This
> Suggestion:
> 
>   _Bool same_signs = (stride > 0) == (scale > 0);
>   if ((same_signs & upper)
>       || (!same_signs && !upper)) {
> 
> generates slightly more code with GCC -O2.  I'd be happy with either.

I agree it's a little odd, but I don't feel strongly about it, so leaving it as is.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17199#issuecomment-1874637742
PR Review Comment: https://git.openjdk.org/jdk/pull/17199#discussion_r1439914558


More information about the hotspot-compiler-dev mailing list