diff --git a/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs b/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs index 57cf6f2b8e00..88ba88d873c9 100644 --- a/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs +++ b/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs @@ -255,6 +255,9 @@ static void ProcessIsDirectBinding (MethodDefinition caller, Instruction ins) Nop (ins); // ldfld MonoTouch.Foundation.IsDirectBinding Instruction next = ins.Next; // brfalse IL_x (SuperHandle processing) Instruction end = null; + // unoptimized compiled code can produce a (unneeeded) store/load combo, leave it there + while (next.OpCode.FlowControl != FlowControl.Cond_Branch) + next = next.Next; // leave the code there (the JIT/AOT will deal with it) ins = (next.Operand as Instruction).Previous; // br end (ret) if (ins.OpCode.Code == Code.Ret) { // if there's not branch but it returns immediately then do not remove the 'ret' instruction ins = ins.Next;