Browse Source

Abort SwitchAnalysis on duplicate condition (redundant code)

pull/1295/head
Chicken-Bones 7 years ago
parent
commit
bf17423618
  1. 2
      ICSharpCode.Decompiler/IL/ControlFlow/SwitchAnalysis.cs

2
ICSharpCode.Decompiler/IL/ControlFlow/SwitchAnalysis.cs

@ -116,6 +116,8 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
if (!(tailOnly || block.Instructions.Count == 2)) if (!(tailOnly || block.Instructions.Count == 2))
return false; return false;
trueValues = trueValues.IntersectWith(inputValues); trueValues = trueValues.IntersectWith(inputValues);
if (trueValues.SetEquals(inputValues) || trueValues.IsEmpty)
return false;
Block trueBlock; Block trueBlock;
if (trueInst.MatchBranch(out trueBlock) && AnalyzeBlock(trueBlock, trueValues)) { if (trueInst.MatchBranch(out trueBlock) && AnalyzeBlock(trueBlock, trueValues)) {
// OK, true block was further analyzed. // OK, true block was further analyzed.

Loading…
Cancel
Save