-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
When we lower arguments to calls we create PUTARG_* nodes and insert them right after their corresponding argument definitions:
runtime/src/coreclr/jit/lower.cpp
Lines 1510 to 1511 in d06fb08
| // Insert the putarg/copy into the block | |
| BlockRange().InsertAfter(arg, putArgOrBitcast); |
This insertion location does not make sense, since conceptually the definitions of the argument nodes can be arbitrarily far away from the call and there can even be interfering calls between the argument and consuming call.
The choice was probably made because the argument placement order is decided during morph when the call is in tree order, and the expectation is that args are placed in the early/late order decided there.
A few potential fixes:
- Insert
PUTARGnodes during rationalization when we can depend on tree order and the early/late args call invariant. Seems to move something that is conceptually ABI lowering into rationalization which is unfortunate. - Insert the
PUTARGnodes right before the call node. Unfortunately has large regressions. - Check for call interference between the arg and call and place the argument early on no interference and late on interference. Probably costs some TP.
- Move arg lowering from morph to lowering with appropriate interference checking (similar to what morph has to do today anyway). Probably best long term solution, but takes the most work.
cc @dotnet/jit-contrib
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI