RFR: 8305324: C2: Wrong execution of vectorizing Interger.reverseBytes [v5]

Daohan Qu duke at openjdk.org
Wed Apr 12 13:39:40 UTC 2023


On Wed, 12 Apr 2023 02:48:23 GMT, Daohan Qu <duke at openjdk.org> wrote:

>> This patch should fix [JDK-8305324](https://bugs.openjdk.org/browse/JDK-8305324).
>> 
>> `SuperWord::compute_vector_element_type()` implemented in `jdk/src/hotspot/share/opto/superword.cpp` propagates backward a narrower integer type when the upper bits of the value are not needed. However, `Integer.reverseBytes()` depends on higher-order bits of an integer and should be prevented from being narrowed and vectorized. Instead, it needs to be treated like `Math.abs()` (which is represented by `Op_AbsI` in the following code).
>> 
>> https://github.com/openjdk/jdk/blob/0243da2e4adc1b7ab6fcd5b10778532101158dce/src/hotspot/share/opto/superword.cpp#L3935-L3945
>> 
>> I have tested this patch for tier 1-3 on x86-64.
>
> Daohan Qu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert some changes for safety

This is my local test result of release build on Ubuntu 22.04 x86_64:

$ make test TEST=tier1
==============================
Test summary
==============================
   TEST                                              TOTAL  PASS  FAIL ERROR   
   jtreg:test/hotspot/jtreg:tier1                     2251  2251     0     0   
   jtreg:test/jdk:tier1                               2328  2328     0     0   
   jtreg:test/langtools:tier1                         4373  4373     0     0   
   jtreg:test/jaxp:tier1                                 0     0     0     0   
   jtreg:test/lib-test:tier1                            28    28     0     0   
==============================
TEST SUCCESS

$ make test TEST=tier2
==============================
Test summary
==============================
   TEST                                              TOTAL  PASS  FAIL ERROR   
   jtreg:test/hotspot/jtreg:tier2                      722   722     0     0   
   jtreg:test/jdk:tier2                               4050  4050     0     0   
   jtreg:test/langtools:tier2                           11    11     0     0   
   jtreg:test/jaxp:tier2                               470   470     0     0   
==============================
TEST SUCCESS

$ make test TEST=tier3
==============================
Test summary
==============================
   TEST                                              TOTAL  PASS  FAIL ERROR   
   jtreg:test/hotspot/jtreg:tier3                      227   227     0     0   
   jtreg:test/jdk:tier3                               1307  1307     0     0   
   jtreg:test/langtools:tier3                            0     0     0     0   
   jtreg:test/jaxp:tier3                                 0     0     0     0   
==============================
TEST SUCCESS

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

PR Comment: https://git.openjdk.org/jdk/pull/13406#issuecomment-1505294494


More information about the hotspot-compiler-dev mailing list