RFR: 8275202: C2: optimize out more redundant conditions
Roland Westrelin
roland at openjdk.org
Tue Feb 6 13:06:56 UTC 2024
On Tue, 30 Jan 2024 15:12:58 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> Would it make sense to handle this case in `IfNode::ideal()`? `IfNode::fold_compares` already handles more complicated cases of integer comparisons. We can match `cmp(i, constant)`, build integer range data, and eliminate IfNode's based on the data.
>>
>> It won't be as powerful as the fixed point optimization that is proposed in this PR, but it is sufficient to cover the case mentioned in the JBS issue and would have less compile time overhead.
>
>> It won't be as powerful as the fixed point optimization that is proposed in this PR, but it is sufficient to cover the case mentioned in the JBS issue and would have less compile time overhead.
>
> I think it would do a lot less so in my opinion, it's worth pursuing the fixed point optimization. The main reason it has such an overhead in the current patch is that it's run too often (every time there's a loop opts pass). There are corner cases that were hard to handled otherwise (and cause the compiler to crash). I've been working on a new version of the patch where the pass is run only once or twice (and found ways to handle the corner cases that were problematic). It's not ready yet.
> @rwestrel Do you plan to cover cases like this?
>
> ```
> if (arr.length - 1 < arr.length)
> ```
I don't expect this to be covered.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14586#issuecomment-1929496146
More information about the hotspot-compiler-dev
mailing list