RFR: 8365205: C2: Optimize popcount value computation using knownbits [v3]

Jatin Bhateja jbhateja at openjdk.org
Wed Sep 10 14:21:00 UTC 2025


On Tue, 9 Sep 2025 11:00:24 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update countbitsnode.cpp
>
> test/hotspot/jtreg/compiler/intrinsics/TestPopCountValueTransforms.java line 148:
> 
>> 146: 
>> 147:     public static void main(String[] args) {
>> 148:         TestFramework.runWithFlags("-XX:-TieredCompilation", "-XX:CompileThresholdScaling=0.2");
> 
> Can you explain the need for these flags?
> The TestFramework eventually enqueues for compilation anyway. Or is there something about profiling?

Thanks for triggering an IR framework refresher :-), these options are only pertinent with Standalone run mode.

> test/micro/org/openjdk/bench/java/lang/PopCountValueTransform.java line 79:
> 
>> 77:         }
>> 78:         return res;
>> 79:     }
> 
> I assume the `stock` kernels are there to show performance if there is no op, the `folding` kernels you hope have the same performance. It would be nice to have one where the `bitCount` does not fold away, just to keep that comparison :)

I see your point, on a second thought, since any benchmarks compare the performance of kernels with and without optimization it's better to do away with the stock variants and only retain folding kernels.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2336929724
PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2336929500


More information about the hotspot-compiler-dev mailing list