JIT: refine arg types based on actual types when creating arg temps #8790
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
enhancement
Product code improvement that does NOT require public API changes/additions
optimization
Milestone
The jit will sometimes evaluate inlining arg values to temps and use those for the args in the inlinee body. The type of the temp is chosen from the callee signature.
The jit then imports the body of the inlinee and considers devirtualizing calls within the body. So this evaluation uses the declared argument type.
Later on, when assigning the arg value to the temp to pass the argument, the jit may refine the type of the temp based on actual type of the argument. This refinement comes too late to trigger devirtualization within the body of the inlinee.
Instead the jit should look at the actual argument type when creating the temp. This will provide a sharper type when examining the inlinee body.
Note existing devirtualization cases like this that "work" today rely on constant or locals that can be directly substituted into the inlinee body, without using a temp, or take advantage of improved types "on the way out" as the call sites being devirtualized are outside of the inlinee body.
Example, thanks to @adamsitnik (and @JosephTremoulet for pointing this out)
Should be relatively simple to fix.
The text was updated successfully, but these errors were encountered: