Don't morph volatile IND(ADDR(LCL_VAR)) (dotnet/coreclr#20843)
authormikedn <onemihaid@hotmail.com>
Fri, 21 Dec 2018 00:10:27 +0000 (02:10 +0200)
committerSergey Andreenko <seandree@microsoft.com>
Fri, 21 Dec 2018 00:10:27 +0000 (16:10 -0800)
commitbf3f21f0124252fdf2e0b0fd26efe3bfaf548916
treedc77a993d03f9c87ee2bea7f5a1508bc349dc5b5
parent853967fecb9a5775098ec864864f494ea6e7e35c
Don't morph volatile IND(ADDR(LCL_VAR)) (dotnet/coreclr#20843)

Besides the fact that volatile indirections aren't supposed to be removed doing so in this case results in incorrect code being generated.

The GT_IND node has GTF_DONT_CSE set and this gets copied to the GT_LCL_VAR node. Later this prevents the insertion of a normalization cast because GTF_DONT_CSE on a GT_LCL_VAR node is assumed to mean that the variable address is being taken.

Commit migrated from https://github.com/dotnet/coreclr/commit/3e216841102ab82a6f4b276aadd8558d78819c12
src/coreclr/src/jit/morph.cpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_19599/GitHub_19599.csproj [new file with mode: 0644]