RFR: 8370196: C2: Improve (U)MulHiLNode::MulHiValue [v3]

Emanuel Peter epeter at openjdk.org
Mon Nov 17 07:28:07 UTC 2025


On Sun, 16 Nov 2025 15:51:10 GMT, Zihao Lin <duke at openjdk.org> wrote:

>> If nodes both are constant, support constant folding.
>
> Zihao Lin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Add tests
>  - Merge branch 'master' into JDK-8370196
>  - test
>  - Update src/hotspot/share/opto/mulnode.cpp
>    
>    Co-authored-by: Andrew Haley <aph-open at littlepinkcloud.com>
>  - C2: Improve (U)MulHiLNode::MulHiValue

@linzihao1999 Thanks for working on this!

To further improve coverage, could you please add `Math.multiplyHigh` and `Math.unsignedMultiplyHigh` to out template library?
`./test/hotspot/jtreg/compiler/lib/template_framework/library/Operations.java`
(see the TODO at the bottom of the file)

We will soon add more operations there anyway. But in the meantime, it would be good to test the methods where we are adding new optimizations.

@SirYwell 
>I think extending from simple constant folding to intervals isn't that much more work.

That's probably true. But we can also do those extensions in a separate RFE.

src/hotspot/share/opto/mulnode.cpp line 622:

> 620: }
> 621: 
> 622: const Type *UMulHiLNode::Value(PhaseGVN *phase) const {

Suggestion:

const Type* UMulHiLNode::Value(PhaseGVN* phase) const {

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

PR Review: https://git.openjdk.org/jdk/pull/28097#pullrequestreview-3471303018
PR Review Comment: https://git.openjdk.org/jdk/pull/28097#discussion_r2532959328


More information about the hotspot-compiler-dev mailing list