Skip to content

RyuJIT x86: GT_STORE_LCL_VAR decomposition is broken #6213

Description

@mikedn

I don't have a test case for this but the existing code is obviously wrong:

tree->gtNext = hiRhs;
hiRhs->gtPrev = tree;
hiRhs->gtNext = hiStore;

tree is actually loStore so this code basically takes the hiRhs node and moves it between loStore and hiStore. This fails whenever hiRhs is not a leaf. I suspect that this sometimes works due to the use of fgNewStmtFromTree, this function re-sequences the hiRhs tree and practically pulls it out from the old statement. But this doesn't happen in the case of embedded statements when fgMakeEmbeddedStmt is used instead.

I experimented with a workaround in dotnet/coreclr#4986 - reverse the store ordering so hiRhs doesn't need to move. However, I'm far from being convinced that this is the right approach.

We could use temporaries again but it feels odd to use temporaries when decomposing GT_STORE_LCL_VAR.

Metadata

Metadata

Assignees

Labels

arch-x86area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbug

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions