From: Andy Ayers Date: Thu, 6 Feb 2020 21:17:05 +0000 (-0800) Subject: JIT: add back no side effect check when optimizing return values (#31836) X-Git-Tag: submit/tizen/20210909.063632~9948 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a44a28b8cf0c319be542cb85913ddc8ecc51126;p=platform%2Fupstream%2Fdotnet%2Fruntime.git JIT: add back no side effect check when optimizing return values (#31836) Feedback from #31699. --- diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index 9528f47..23bc843 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -22617,8 +22617,10 @@ Compiler::fgWalkResult Compiler::fgLateDevirtualization(GenTree** pTree, fgWalkD JITDUMP(" ... found foldable jtrue at [%06u] in BB%02u\n", dspTreeID(tree), block->bbNum); noway_assert((block->bbNext->countOfInEdges() > 0) && (block->bbJumpDest->countOfInEdges() > 0)); - // Had hoped to assert here that we are not losing any - // side effects, but can't find a way to express it properly. + // We have a constant operand, and should have the all clear to optimize. + // Update side effects on the tree, assert there aren't any, and bash to nop. + comp->gtUpdateNodeSideEffects(tree); + assert((tree->gtFlags & GTF_SIDE_EFFECT) == 0); tree->gtBashToNOP(); BasicBlock* bTaken = nullptr;