RFR: 8324655: Identify integer minimum and maximum patterns created with if statements [v3]
Jasmine Karthikeyan
jkarthikeyan at openjdk.org
Fri Mar 22 21:05:27 UTC 2024
On Tue, 27 Feb 2024 17:31:44 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> @merykitty I am thinking of a case like this:
>>
>> a = <something very expensive>
>> b = <something cheap>
>> x = (a < b) ? a : b;
>>
>> If in most cases we take `b` (because it is larger), then we might speculatively assign `x = b`, before we have finished computing `a`. That way we can already continue (speculatively) with `x = b`, while `a` is still computing. If the speculation is wrong, then the CPU flushes the pipeline.
>>
>> If this is converted to `max/min`, then we need to wait for `a` to be computed.
>>
>> @merykitty @jaskarth does this make sense as an example for a potential performance regression?
>
> @eme64 Thanks for making that clear. I'm asking @jaskarth if it is easier to transform a `CMove` into a `Min`/`Max` instead of trying to look for matching `Phi`s.
Thanks for the review, @merykitty!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17574#issuecomment-2015910313
More information about the hotspot-compiler-dev
mailing list