Skip to content

Commit

Permalink
Merge pull request dotnet#6914 from echesakov/ValueNumberingAssertFix
Browse files Browse the repository at this point in the history
Bug fix: fgOptimizeBranch loses bbFlags while duplicating the conditional block
  • Loading branch information
echesakov authored Aug 26, 2016
2 parents 74ac12b + 12f3274 commit 2476368
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14170,6 +14170,10 @@ bool Compiler::fgOptimizeBranch(BasicBlock* bJump)
/* 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
Expand Down
6 changes: 5 additions & 1 deletion src/jit/objectalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ void ObjectAllocator::MorphAllocObjNodes()

foreach_block(comp, block)
{
if ((block->bbFlags & BBF_HAS_NEWOBJ) == 0)
const bool basicBlockHasNewObj = (block->bbFlags & BBF_HAS_NEWOBJ) == BBF_HAS_NEWOBJ;
#ifndef DEBUG
if (!basicBlockHasNewObj)
{
continue;
}
#endif // DEBUG

for (GenTreeStmt* stmt = block->firstStmt(); stmt; stmt = stmt->gtNextStmt)
{
Expand All @@ -90,6 +93,7 @@ void ObjectAllocator::MorphAllocObjNodes()

if (canonicalAllocObjFound)
{
assert(basicBlockHasNewObj);
//------------------------------------------------------------------------
// We expect the following expression tree at this point
// * GT_STMT void (top level)
Expand Down

0 comments on commit 2476368

Please sign in to comment.