On Tue, 8 Mar 2022 15:36:22 GMT, Quan Anh Mai <d...@openjdk.java.net> wrote:

> Can we change the optimizer so that the strength reduction happens only after 
> all transformations have settled? Carelessly changing a multiplication to a 
> shift as today may hurt a lot of potential optimisations. Thanks.

Yes, it's troubling that making a constant non-foldable can lead the JIT down a 
path that ultimately pessimizes the end result (as observed here). If we could 
train the JIT to avoid this pitfall and get to the improvement observed in my 
experiment here without any changes to `String.java` then that'd be great.

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

PR: https://git.openjdk.java.net/jdk/pull/7700

Reply via email to