From 58276b19e9d42231df49b7e6256a79deb0b21f5d Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Wed, 2 Nov 2016 12:39:40 -0700 Subject: [PATCH] Properly update block flags during branch opt. `fgOptimizeBranch` was updating the flags for the predecessor block using the flags from the wrong destination block. This was causing an assert in `AllocateObjects` when verifying that all blocks that contain `allocObj` nodes are properly marked with `BBF_HAS_NEWOBJ`. Commit migrated from https://github.com/dotnet/coreclr/commit/b0e3c23069a73943f52014b3cba52c56a6839439 --- src/coreclr/src/jit/flowgraph.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index 7122869..c02bd50 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -14163,16 +14163,16 @@ bool Compiler::fgOptimizeBranch(BasicBlock* bJump) // gtReverseCond(condTree); + // We need to update the following flags of the bJump block if they were set in the bbJumpDest block + bJump->bbFlags |= (bDest->bbFlags & + (BBF_HAS_NEWOBJ | BBF_HAS_NEWARRAY | BBF_HAS_NULLCHECK | BBF_HAS_IDX_LEN | BBF_HAS_VTABREF)); + bJump->bbJumpKind = BBJ_COND; bJump->bbJumpDest = bDest->bbNext; /* Mark the jump dest block as being a jump target */ bJump->bbJumpDest->bbFlags |= BBF_JMP_TARGET | BBF_HAS_LABEL; - // We need to update the following flags of the bJump block if they were set in the bbJumpDest block - bJump->bbFlags |= (bJump->bbJumpDest->bbFlags & - (BBF_HAS_NEWOBJ | BBF_HAS_NEWARRAY | BBF_HAS_NULLCHECK | BBF_HAS_IDX_LEN | BBF_HAS_VTABREF)); - /* Update bbRefs and bbPreds */ // bJump now falls through into the next block -- 2.7.4