jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8331090: Run Ideal_minmax before de-canonicalizing CMoves

Open jaskarth opened this issue 1 year ago • 9 comments

Hi all, This patch aims to solve some CMove min/max patterns not being recognized due to the BoolNode comparison being non-canonical, as was reported in #18824. This can occur due to other Ideal transforms done by CMoves, such as in here and here. These transforms move constants and zero-types to the right hand side of the CMove by flipping the comparison, potentially de-canonicalizing it. These invariants are used later on in the ad files to emit more optimized assembly for these patterns. Since these existing patterns are useful to have, I think the best way to solve this would be to move Ideal_minmax before the branches are swapped and the BoolNode is negated. This should increase the set of inputs that the idealization is able to transform.

Tier 1-3 testing passes on my machine. Reviews and comments would be appreciated!


Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8331090: Run Ideal_minmax before de-canonicalizing CMoves (Enhancement - P5)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19914/head:pull/19914
$ git checkout pull/19914

Update a local copy of the PR:
$ git checkout pull/19914
$ git pull https://git.openjdk.org/jdk.git pull/19914/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19914

View PR using the GUI difftool:
$ git pr show -t 19914

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19914.diff

Webrev

Link to Webrev Comment

jaskarth avatar Jun 26 '24 18:06 jaskarth

:wave: Welcome back jkarthikeyan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Jun 26 '24 18:06 bridgekeeper[bot]

@jaskarth This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8331090: Run Ideal_minmax before de-canonicalizing CMoves

Reviewed-by: thartmann, epeter

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 428 new commits pushed to the master branch:

  • a91f9ba84906dae10b050e15307ba0f0f05af3e4: 8301403: Eliminate memory allocations in JVMFlag::printFlags during signal handling
  • 2c9fd9016f4675448a62380ff2b86533020e690f: 8336315: tools/jpackage/windows/WinChildProcessTest.java Failed: Check is calculator process is alive
  • 1cb27f7e2355ccb911bb274fc004e5bc57fd5dc9: 8334230: Optimize C2 classes layout
  • 41486131481164a559aa534807fe1a77a7d29fc8: 8335907: JFR: Make SettingControls more robust
  • 79bdd811876d75974536aac088bae1719387c97f: 8336763: Parallel: Merge PCMarkAndPushClosure and PCIterateMarkAndPushClosure
  • 8162832832ac6e8c17f942e718e309a3489e0da6: 8333354: ubsan: frame.inline.hpp:91:25: and src/hotspot/share/runtime/frame.inline.hpp:88:29: runtime error: member call on null pointer of type 'const struct SmallRegisterMap'
  • 0325ab8d2353f29ac40ff4b028cbc29bff40c59b: 8335610: DiagnosticFramework: CmdLine::is_executable() correction
  • 7ac531181c25815577ba2f6f426e1da270e4f589: 8331126: [s390x] secondary_super_cache does not scale well
  • 156f0b4332bf076165898417cf6678d2fc32df5c: 8337213: Shenandoah: Add verification for class mirrors
  • 9e6e0a8f341389215f0db6b2260f2b16351f02be: 8336343: Add more known sysroot library locations for ALSA
  • ... and 418 more: https://git.openjdk.org/jdk/compare/93d98027649615afeeeb6a9510230d9655a74a8f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Jun 26 '24 18:06 openjdk[bot]

@jaskarth The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Jun 26 '24 18:06 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jun 26 '24 18:06 mlbridge[bot]

Thank you for the review @TobiHartmann!

jaskarth avatar Jul 01 '24 13:07 jaskarth

Testing passed. A second review would be good.

TobiHartmann avatar Jul 02 '24 14:07 TobiHartmann

@TobiHartmann did you run performance benchmarking, just in case?

eme64 avatar Jul 03 '24 05:07 eme64

Just asking because we had some regressions recently around CMove ;)

eme64 avatar Jul 03 '24 05:07 eme64

No, I did not run any performance testing yet.

TobiHartmann avatar Jul 03 '24 07:07 TobiHartmann

@TobiHartmann the testing looks clean.

eme64 avatar Jul 30 '24 17:07 eme64

Thanks for the testing and review @eme64!

/integrate

jaskarth avatar Jul 31 '24 15:07 jaskarth

Going to push as commit f2ba2ebbcaba2784b24e7fe94c235ca652f7c9a2. Since your change was applied there have been 442 commits pushed to the master branch:

  • 7121d71b516b415c7c11e3643731cd32d4057aa6: 8337421: RISC-V: client VM build failure after JDK-8335191
  • 61386c199a3b29457c002ad31a23990b7f6f88fd: 8337523: Fix -Wzero-as-null-pointer-constant warnings in jvmci code
  • 07dd725025a54035436a76ac4c0a8bb2b12e264a: 8337418: Fix -Wzero-as-null-pointer-constant warnings in prims code
  • c73b3cb5996723c5a15c833a9da059b79c99cf9c: 8336635: Add IR test for Reference.refersTo intrinsic
  • 9b428dda8fb86ed595b05f3c930b3ce9c341db9b: 8336242: compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java failed assert(oopDesc::is_oop_or_null(val)) failed: bad oop found (again)
  • de0b50400a4155554c83d5c3346ab1ec5353df61: 8336912: G1: Undefined behavior for G1ConfidencePercent=0
  • e63d01654e0b702b3a8c0c4de97a6bb6893fbd1f: 8337031: Improvements to CompilationMemoryStatistic
  • 1c6fef8f1cd12b26de9d31799a6516ce4399313f: 8337515: JVM_DumpAllStacks is dead code
  • 5b7bb40d1f5a8e1261cc252db2a09b5e4f07e5f0: 8325002: Exceptions::fthrow needs to ensure it truncates to a valid utf8 string
  • d39e7af2e5d28df43c0b2dad770f41adede5cc29: 8320561: Inconsistency in monitorinflation logging
  • ... and 432 more: https://git.openjdk.org/jdk/compare/93d98027649615afeeeb6a9510230d9655a74a8f...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Jul 31 '24 15:07 openjdk[bot]

@jaskarth Pushed as commit f2ba2ebbcaba2784b24e7fe94c235ca652f7c9a2.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Jul 31 '24 15:07 openjdk[bot]