RFR: 8353551: C2: Constant folding for ReverseBytes nodes

Johannes Graham duke at openjdk.org
Fri Apr 4 17:24:54 UTC 2025


On Wed, 2 Apr 2025 16:17:57 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

> This change implements constant folding for ReverseBytes nodes.
> 
> Currently, `byteswap` is included transitively by `reverse_bits.hpp`. I'm not sure if this is fine or if I need to add an explicit include there.
> 
> I appreciate any reviews and comments.

src/hotspot/share/opto/subnode.cpp line 2025:

> 2023: 
> 2024: template<typename T, BasicType B>
> 2025: const Type* reverse_bytes(const Node* node, PhaseGVN* phase) {

Could this be templated with TypeLong/TypeInt instead of BasicType? There is a `try_cast` that @merykitty added in https://github.com/openjdk/jdk/pull/17508 that might help.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24382#discussion_r2029183060


More information about the hotspot-compiler-dev mailing list