JDK-8347901 : C2 should remove unused leaf / pure runtime calls
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-01-16
  • Updated: 2025-09-15
  • Resolved: 2025-07-22
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.
JDK 26
26 b08Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
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
Changeset: ed70910b Branch: master Author: Marc Chevalier <mchevalier@openjdk.org> Date: 2025-07-22 08:48:07 +0000 URL: https://git.openjdk.org/jdk/commit/ed70910b0f3e1b19d915ec13ac3434407d01bc5d
22-07-2025

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