Skip to content

Audit direct usages of SetRegOptional/SetContained #77901

@tannergooding

Description

@tannergooding

There are several rules that apply to when SetRegOptional and SetContained can be safely called, namely we need to ensure that there are no side effects that exist between parentNode and childNode and in the case of SetContained we need to ensure that childNode is a containable memory operand.

We've had MakeSrcContained for a while and it calls SetContained while also validating that it is being used correctly.

#77895 is adding a similar MakeSrcRegOptional API that ensures SetRegOptional is likewise being used correctly and a new TryMakeSrcContainedOrRegOptional that handles both simultaneously.

However, there are a number of remaining places that call SetContained and SetRegOptional directly and which may be doing the wrong thing. We likewise have specific examples where fixing it do to the "right thing" may introduce new bugs: #77895 (comment)

We should go through the code and fix all remaining usages to go through MakeSrcContained/RegOptional and ensure complex cases like the PUTARGSTK/FIELDLIST are correctly lowered to sequences that cannot cause register allocation failures.

Metadata

Metadata

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions