RFR: 8305324: C2: Wrong execution of vectorizing Interger.reverseBytes

Daohan Qu duke at openjdk.org
Mon Apr 10 10:55:39 UTC 2023


This patch should fix [JDK-8305324](https://bugs.openjdk.org/browse/JDK-8305324).

`SuperWord::compute_vector_element_type()` 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 vectorized like `Math.abs()`( which is `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.

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

Commit messages:
 - Add a jtreg test for 8305324
 - Prevent integer narrowed type backward propagation from passing through Op_ReverseBytesI operation, which should fix 8305324

Changes: https://git.openjdk.org/jdk/pull/13404/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13404&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8305324
  Stats: 57 lines in 2 files changed: 56 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/13404.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13404/head:pull/13404

PR: https://git.openjdk.org/jdk/pull/13404


More information about the hotspot-compiler-dev mailing list