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
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
- duplicates
-
JDK-8350494 Missed dead code elimination in C2
-
- Closed
-
-
JDK-6440430 C2 does not optimize away pointless calls to nanoTime, currentTimeMillis
-
- Closed
-
- relates to
-
JDK-8218414 VM annotation to mark methods w/o side effects
-
- Open
-
-
JDK-8349523 Unused runtime calls to drem/frem should be removed
-
- Resolved
-