diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-08-24 12:49:34 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-08-24 12:49:34 -0700 |
commit | 767e9175ea115425b814432c4362afb0d83b3668 (patch) | |
tree | e073a333788d03de23360bf9048ef771f7433f03 | |
parent | 5d8b6c70296a4433745e81eaaff44238abb468bf (diff) | |
parent | ad245f8f4faee15e9045f2d781ce41fa60458058 (diff) | |
download | coreclr-767e9175ea115425b814432c4362afb0d83b3668.tar.gz coreclr-767e9175ea115425b814432c4362afb0d83b3668.tar.bz2 coreclr-767e9175ea115425b814432c4362afb0d83b3668.zip |
Merge pull request #1431 from dotnet-bot/from-tfs
Merge changes from TFS
-rw-r--r-- | src/jit/flowgraph.cpp | 5 | ||||
-rw-r--r-- | src/jit/optimizer.cpp | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index e7b7584ae8..5e24ab918b 100644 --- a/src/jit/flowgraph.cpp +++ b/src/jit/flowgraph.cpp @@ -14096,6 +14096,11 @@ bool Compiler::fgOptimizeBranch(BasicBlock* bJump) if (bDest->bbJumpDest != bJump->bbNext) return false; + // 'bJump' must be in the same try region as the condition, since we're going to insert + // a duplicated condition in 'bJump', and the condition might include exception throwing code. + if (!BasicBlock::sameTryRegion(bJump, bDest)) + return false; + // do not jump into another try region BasicBlock* bDestNext = bDest->bbNext; if (bDestNext->hasTryIndex() && !BasicBlock::sameTryRegion(bJump, bDestNext)) diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp index 2f781e9840..7e85f60a3e 100644 --- a/src/jit/optimizer.cpp +++ b/src/jit/optimizer.cpp @@ -3316,6 +3316,17 @@ void Compiler::fgOptWhileLoop(BasicBlock * block) // Since test is a BBJ_COND it will have a bbNext noway_assert(bTest->bbNext); + // 'block' must be in the same try region as the condition, since we're going to insert + // a duplicated condition in 'block', and the condition might include exception throwing code. + if (!BasicBlock::sameTryRegion(block, bTest)) + return; + + // We're going to change 'block' to branch to bTest->bbNext, so that also better be in the + // same try region (or no try region) to avoid generating illegal flow. + BasicBlock* bTestNext = bTest->bbNext; + if (bTestNext->hasTryIndex() && !BasicBlock::sameTryRegion(block, bTestNext)) + return; + GenTreePtr condStmt = optFindLoopTermTest(bTest); // bTest must only contain only a jtrue with no other stmts, we will only clone |