RFR: 8319451: PhaseIdealLoop::conditional_move is too conservative
Vladimir Kozlov
kvn at openjdk.org
Mon Nov 13 19:56:14 UTC 2023
On Mon, 6 Nov 2023 19:10:42 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
> Hi,
>
> When transforming a Phi into a CMove, the threshold is set to be approximately BlockLayoutMinDiamondPercentage, the reason is given:
>
> // BlockLayoutByFrequency optimization moves infrequent branch
> // from hot path. No point in CMOV'ing in such case
>
> This sets the default value of the threshold to be around 18%, which is too conservative. The reason also does not make a lot of sense since the important property which makes jumping expensive is not code layout. We should remove this.
>
> Please kindly review, thank you very much.
Looks fine to me.
Looking on history of this code and I added it to address [JDK-7097546](https://bugs.openjdk.org/browse/JDK-7097546).
But later it was found not correct for some case and I even had similar fix prototype: [JDK-8034833](https://bugs.openjdk.org/browse/JDK-8034833). There was additional changes proposed there: in `block.hpp` and `.ad` file.
Please, look on attached in that report test and additional code changes there. May be be we can improve more `cmove`. It could be done separately from this your fix if you want to spend more time on it.
-------------
PR Review: https://git.openjdk.org/jdk/pull/16524#pullrequestreview-1728151280
More information about the hotspot-compiler-dev
mailing list