Browse Source

Make the detection of the unpin `stloc` more strict

pull/3110/head
ElektroKill 2 years ago
parent
commit
0e64adc755
No known key found for this signature in database
GPG Key ID: 7E3C5C084E40E3EC
  1. 3
      ICSharpCode.Decompiler/IL/ControlFlow/DetectPinnedRegions.cs

3
ICSharpCode.Decompiler/IL/ControlFlow/DetectPinnedRegions.cs

@ -621,7 +621,8 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -621,7 +621,8 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
{
unpinBlock = br.TargetBlock;
}
else if (innerBlock.Instructions[0].MatchIfInstruction(out _, out var trueInstr) &&
else if (innerBlock.Instructions.Count == 2 &&
innerBlock.Instructions[0].MatchIfInstruction(out _, out var trueInstr) &&
trueInstr is Branch trueBr && trueBr.TargetContainer == sourceContainer &&
reachedEdgesPerBlock[trueBr.TargetBlock.ChildIndex] == 0)
{

Loading…
Cancel
Save