diff --git a/ICSharpCode.Decompiler/IL/Transforms/StatementTransform.cs b/ICSharpCode.Decompiler/IL/Transforms/StatementTransform.cs index 51911595d..59a8dbbbd 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/StatementTransform.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/StatementTransform.cs @@ -133,7 +133,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms } foreach (var transform in children) { - Debug.Assert(block.HasFlag(InstructionFlags.EndPointUnreachable)); transform.Run(block, pos, ctx); #if DEBUG block.Instructions[pos].CheckInvariant(ILPhase.Normal); @@ -160,6 +159,10 @@ namespace ICSharpCode.Decompiler.IL.Transforms pos--; } } + // This invariant can be surprisingly expensive to check if the block has thousands + // of instructions and is frequently modified by transforms (invalidating the flags each time) + // so we'll check this only once at the end of the block. + Debug.Assert(block.HasFlag(InstructionFlags.EndPointUnreachable)); } } }