|
|
@ -111,16 +111,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms |
|
|
|
&& inst.Sign == Sign.Unsigned |
|
|
|
&& inst.Sign == Sign.Unsigned |
|
|
|
&& (inst.Kind == ComparisonKind.GreaterThan || inst.Kind == ComparisonKind.LessThanOrEqual)) |
|
|
|
&& (inst.Kind == ComparisonKind.GreaterThan || inst.Kind == ComparisonKind.LessThanOrEqual)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ILInstruction array; |
|
|
|
|
|
|
|
if (inst.Left.MatchLdLen(StackType.I, out array)) { |
|
|
|
|
|
|
|
// comp.unsigned(ldlen array > conv i4->i(ldc.i4 0))
|
|
|
|
|
|
|
|
// => comp(ldlen.i4 array > ldc.i4 0)
|
|
|
|
|
|
|
|
// This is a special case where the C# compiler doesn't generate conv.i4 after ldlen.
|
|
|
|
|
|
|
|
context.Step("comp(ldlen.i4 array > ldc.i4 0)", inst); |
|
|
|
|
|
|
|
inst.InputType = StackType.I4; |
|
|
|
|
|
|
|
inst.Left.ReplaceWith(new LdLen(StackType.I4, array) { ILRange = inst.Left.ILRange }); |
|
|
|
|
|
|
|
inst.Right = rightWithoutConv; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (inst.Kind == ComparisonKind.GreaterThan) { |
|
|
|
if (inst.Kind == ComparisonKind.GreaterThan) { |
|
|
|
context.Step("comp.unsigned(left > ldc.i4 0) => comp(left != ldc.i4 0)", inst); |
|
|
|
context.Step("comp.unsigned(left > ldc.i4 0) => comp(left != ldc.i4 0)", inst); |
|
|
|
inst.Kind = ComparisonKind.Inequality; |
|
|
|
inst.Kind = ComparisonKind.Inequality; |
|
|
@ -132,6 +122,16 @@ namespace ICSharpCode.Decompiler.IL.Transforms |
|
|
|
VisitComp(inst); |
|
|
|
VisitComp(inst); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (rightWithoutConv.MatchLdcI4(0) && inst.Kind.IsEqualityOrInequality()) { |
|
|
|
|
|
|
|
if (inst.Left.MatchLdLen(StackType.I, out ILInstruction array)) { |
|
|
|
|
|
|
|
// comp.unsigned(ldlen array == conv i4->i(ldc.i4 0))
|
|
|
|
|
|
|
|
// => comp(ldlen.i4 array == ldc.i4 0)
|
|
|
|
|
|
|
|
// This is a special case where the C# compiler doesn't generate conv.i4 after ldlen.
|
|
|
|
|
|
|
|
context.Step("comp(ldlen.i4 array == ldc.i4 0)", inst); |
|
|
|
|
|
|
|
inst.InputType = StackType.I4; |
|
|
|
|
|
|
|
inst.Left.ReplaceWith(new LdLen(StackType.I4, array) { ILRange = inst.Left.ILRange }); |
|
|
|
|
|
|
|
inst.Right = rightWithoutConv; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (inst.Right.MatchLdNull() && inst.Left.MatchBox(out arg, out var type) && type.Kind == TypeKind.TypeParameter) { |
|
|
|
if (inst.Right.MatchLdNull() && inst.Left.MatchBox(out arg, out var type) && type.Kind == TypeKind.TypeParameter) { |
|
|
|