JDK-8347901 allows C2 to remove pure calls when the result is unused. Yet, pure calls are still control-pinned, which limits the optimization potential. It's for instance not yet possible to hoist a loop-invariant pure call above the loop, or push a pure call into a if-branch when the else-branch doesn't use the result.
The control input and output of pure calls are useful to lower them into regular leaf call. Multiple ways are possible:
- keep the control-pinning but move the calls manually
- not pin pure calls until we can find where the value is needed (during loop opts), and pin them somewhere (outside of as many loops as possible, then as late as possible?)
- not have control at all, let GCM do the job, and not lower into leaf call, but then something else needs to be done to generate code at the end.
- ???
The control input and output of pure calls are useful to lower them into regular leaf call. Multiple ways are possible:
- keep the control-pinning but move the calls manually
- not pin pure calls until we can find where the value is needed (during loop opts), and pin them somewhere (outside of as many loops as possible, then as late as possible?)
- not have control at all, let GCM do the job, and not lower into leaf call, but then something else needs to be done to generate code at the end.
- ???
- relates to
-
JDK-8347901 C2 should remove unused leaf / pure runtime calls
-
- In Progress
-