JIT: Generalize assignment decomposition in physical promotion (#85323)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Sat, 6 May 2023 10:06:16 +0000 (12:06 +0200)
committerGitHub <noreply@github.com>
Sat, 6 May 2023 10:06:16 +0000 (12:06 +0200)
commit40cad3c34fce34ca58bb616fcae2fb609c9d8be9
tree3273b615283b9f16e61554b508d2db6eadda5a87
parent6649f98821807555fc7c1d009ba4dd5fcd01163d
JIT: Generalize assignment decomposition in physical promotion (#85323)

Generalize assignment decomposition to handle arbitrary combinations of
physically promoted structs. Do this by introducing a DecompositionPlan
class that keeps track of the copies to do that involve replacement
fields. The first step is then to fill out this plan. In the general
case where both the source and destination are physically promoted this
involves iterating the replacements in lockstep. For promotions that map
exactly, a direct copy between their locals is queued into the plan; in
other cases (e.g. partial overlap) it may involve writing the source
back to the struct local.

The plan is used to generate the IR and to figure out the best strategy to
use for the remaining parts of the struct. Additional it is used to check for
some optimization opportunities (e.g. we avoid superfluous write barriers
in some cases).
src/coreclr/jit/compiler.h
src/coreclr/jit/gentree.cpp
src/coreclr/jit/jitstd/vector.h
src/coreclr/jit/morphblock.cpp
src/coreclr/jit/promotion.cpp
src/coreclr/jit/promotion.h
src/coreclr/jit/promotiondecomposition.cpp
src/coreclr/jit/utils.cpp
src/coreclr/jit/utils.h
src/tests/JIT/Directed/physicalpromotion/mixedpromotion.cs
src/tests/JIT/Directed/physicalpromotion/physicalpromotion.cs