Fix check for memory containment safety. (#22563)
authorEugene Rozenfeld <erozen@microsoft.com>
Thu, 14 Feb 2019 22:43:26 +0000 (14:43 -0800)
committerGitHub <noreply@github.com>
Thu, 14 Feb 2019 22:43:26 +0000 (14:43 -0800)
commit6c9ad257e78977c9fd5d2429490b5d2f72c1b612
treecb52a07d50601f0255c2d537552689435defe084
parent171be182943cd4633d5408c5b36b4cf56eefe9e1
Fix check for memory containment safety. (#22563)

This change ensures that if an operand can produce an exception
and any instructions executed after the operand evaluation but before
the operand's parent can also produce an exception, the operand
shouldn't be contained. The reason is that in this case operand
containment may reorder exceptions.

With `strict` set to true the containment is blocked here:
https://github.com/dotnet/coreclr/blob/d27fff3f65193dd71c6197e9876101f496bbd28b/src/jit/sideeffects.cpp#L485-L488

Also, make the check for ordering side-effect interference less
conservative.

Fixes #22556.
src/jit/lower.cpp
src/jit/sideeffects.cpp
tests/src/JIT/Regression/JitBlue/GitHub_22556/GitHub_22556.cs [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/GitHub_22556/GitHub_22556.csproj [new file with mode: 0644]