-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix loop canonicalization for call-finally case (#76734)
* Fix loop canonicalization for call-finally case If a call-finally is followed by a loop body that requires canonicalization, we hit an assert that the `head` block preceding the loop must be a fall-through block. This was true in all cases except if the preceding block was the BBJ_ALWAYS of a BBJ_CALLFINALLY/BBJ_ALWAYS pair. To fix this, add a new canonicalization. If this case occurs, simply insert a new fall-through block above the loop top and redirect the BBJ_ALWAYS to that new block. Fixes #76346 * Add unit test
- Loading branch information
1 parent
744fc9b
commit 3435b39
Showing
3 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/tests/JIT/Regression/JitBlue/Runtime_76346/Runtime_76346.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
public class Program | ||
{ | ||
public static int Main() | ||
{ | ||
int i = 0; | ||
|
||
try | ||
{ | ||
Console.WriteLine("Running... {0}", i); | ||
} | ||
finally | ||
{ | ||
// Don't want this to be cloned, so add more EH | ||
Console.WriteLine("In finally1"); | ||
try | ||
{ | ||
Console.WriteLine("try2... {0}", i); | ||
} | ||
finally | ||
{ | ||
Console.WriteLine("finally2... {0}", i); | ||
} | ||
} | ||
do | ||
{ | ||
do | ||
{ | ||
++i; | ||
} while (i % 19 != 0); | ||
} while (i < 40); | ||
|
||
return (i == 57) ? 100 : 101; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_76346/Runtime_76346.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |