From: Pat Gavlin Date: Tue, 25 Oct 2016 21:56:56 +0000 (-0700) Subject: Clear side-effect flags on local reads in rationalize. X-Git-Tag: accepted/tizen/base/20180629.140029~3239^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e002fd3c5d2b01a28f6af1679d17554d88098e9;p=platform%2Fupstream%2Fcoreclr.git Clear side-effect flags on local reads in rationalize. These operations are always side-effect free. --- diff --git a/src/jit/rationalize.cpp b/src/jit/rationalize.cpp index 42c2cf6..70d9e7a 100644 --- a/src/jit/rationalize.cpp +++ b/src/jit/rationalize.cpp @@ -865,12 +865,18 @@ Compiler::fgWalkResult Rationalizer::RewriteNode(GenTree** useEdge, ArrayStackOperIsLocalRead()) + if (node->OperIsLocalRead()) { - assert((node->gtFlags & GTF_ALL_EFFECT) == 0); - - comp->lvaDecRefCnts(node); - BlockRange().Remove(node); + if (use.IsDummyUse()) + { + comp->lvaDecRefCnts(node); + BlockRange().Remove(node); + } + else + { + // Local reads are side-effect-free; clear any flags leftover from frontend transformations. + node->gtFlags &= ~GTF_ALL_EFFECT; + } } assert(isLateArg == ((use.Def()->gtFlags & GTF_LATE_ARG) != 0));