From 6c9ad257e78977c9fd5d2429490b5d2f72c1b612 Mon Sep 17 00:00:00 2001 From: Eugene Rozenfeld Date: Thu, 14 Feb 2019 14:43:26 -0800 Subject: 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/jit/lower.cpp') diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp index 2c4c071a35..fc507c4c50 100644 --- a/src/jit/lower.cpp +++ b/src/jit/lower.cpp @@ -87,7 +87,8 @@ bool Lowering::IsSafeToContainMem(GenTree* parentNode, GenTree* childNode) for (GenTree* node = childNode->gtNext; node != parentNode; node = node->gtNext) { - if (m_scratchSideEffects.InterferesWith(comp, node, false)) + const bool strict = true; + if (m_scratchSideEffects.InterferesWith(comp, node, strict)) { return false; } -- cgit v1.2.3