RFR: 8325674: Constant fold across compares
Emanuel Peter
epeter at openjdk.org
Tue Feb 27 10:05:56 UTC 2024
On Mon, 26 Feb 2024 23:26:43 GMT, Joshua Cao <duke at openjdk.org> wrote:
> I do not. I can turn the tests into micro-benchmarks, but I don't think those simple tests would show any meaningful data.
I am asking for it because your change brings some risks. Messing with RangeChecks is risky business. Dropping guards wrongly opens us up to out of bounds access.
> I think constant folding is a free enough win where we do not have to look for significant differences in benchmarks.
Hmm. Not sure this is sufficient. Every optimization brings complexity, bugs and maintenance cost. There are lots of "cool constant folding optimizations", but we cannot do them all.
We already do RangeCheck elimination (RCE) from main-loops. So the overhead is (in most cases) restricted to pre and post loops. Because of RCE, you probably can hardly measure a performance boost with your optimization.
I'm not trying to shoot your work down, but I'm a bit scared of it 😅
Similar questions will apply for your proposal in https://bugs.openjdk.org/browse/JDK-8325995
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17853#issuecomment-1966192649
More information about the hotspot-compiler-dev
mailing list