JDK-8345170 : Use eqv_uncast in *Mod*Nodes::value in divnode.cpp
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 24
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2024-11-28
  • Updated: 2025-03-21
  • Resolved: 2025-03-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Relates :  
Description
The *Mod*Node::value methods contain comparisons of the form:

// X MOD X is 0
  if (in(1) == in(2)) {

More of these might be added in JDK-8332268

These could be improved by using mod->in(1)->eqv_uncast(mod->in(2)) to see through the cast nodes as discussed here: https://github.com/openjdk/jdk/pull/22061#discussion_r1856621633
Comments
Thanks for the investigation, Manuel. I agree with closing this issue.
21-03-2025

After some investigation, I would recommend to close this RFR as not applicable. The optimization would have no effect in our current codebase. I replaced `if (in(1) == in(2)) {` with ```c++ if (in(1)->eqv_uncast(in(2)) { assert(in(1) == in(2), "optimization opportunity"); ``` and ran a lot of tests to see if the proposed fix could find more optimization opportunities. All tests passed or failed unrelated to the added asserts. Investigation commit: https://github.com/mhaessig/jdk/commit/55977c2f35dbc14b5bc40fc5833972084996c4be
21-03-2025