RFR: 8365205: C2: Optimize popcount value computation using knownbits [v11]
    Jatin Bhateja 
    jbhateja at openjdk.org
       
    Sat Oct  4 04:12:50 UTC 2025
    
    
  
On Fri, 3 Oct 2025 12:14:46 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update countbitsnode.cpp
>
> src/hotspot/share/opto/countbitsnode.cpp line 145:
> 
>> 143:   }
>> 144:   KnownBits<juint> bits = t->isa_int()->_bits;
>> 145:   return TypeInt::make(population_count(bits._ones), population_count(~bits._zeros), Type::WidenMax);
> 
> The `widen` of the output should be the same as the `widen` of the input, not `WidenMax` here.
Thanks @merykitty, widen is mainly used for optimistic data flow analysis pass like CCP where type analysis begins with TOP and progressively grows the value range till convergence / fixed point.
it's good to preserve the widen of input to delay eager convergence.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2403728728
    
    
More information about the hotspot-compiler-dev
mailing list