JDK-8347901 : C2 should remove unused leaf / pure runtime calls
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P3
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2025-01-16
  • Updated: 2025-06-11
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
tbdUnresolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
We got several reports in the past like JDK-8349523 and JDK-6440430 that C2 does not remove leaf / pure runtime calls when the result is not used. We should add this capability to C2.

Suggestion by Quan Anh Mai:
What do you think about using a general-purpose CallPureNode that represents a call not reading or writing external modifiable states? Apart from ModF and ModD, there are several other nodes that may benefit from this such as the trigonometric functions, svml calls, etc. A CallPureNode does not have input and output control or memory, which makes it more susceptible to GVN and deadcode elimination, as well as allowing it to be more freely scheduled.

https://github.com/openjdk/jdk/pull/22786#issuecomment-2585016091
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25760 Date: 2025-06-11 16:18:41 +0000
11-06-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24966 Date: 2025-04-30 13:18:33 +0000
02-05-2025

`CallLeafNode` and subclasses are suppose such nodes.
16-01-2025