diff --git a/compiler/avr/aoptcpu.pas b/compiler/avr/aoptcpu.pas index 4e537d1e39..9f2f1c51c9 100644 --- a/compiler/avr/aoptcpu.pas +++ b/compiler/avr/aoptcpu.pas @@ -696,6 +696,20 @@ Implementation end; end; + A_CALL: + if (cs_opt_level4 in current_settings.optimizerswitches) and + GetNextInstruction(p,hp1) and + MatchInstruction(hp1,A_RET) then + begin + DebugMsg('Peephole CallReg2Jmp performed', p); + + taicpu(p).opcode:=A_JMP; + + asml.Remove(hp1); + hp1.Free; + + result:=true; + end; A_MOV: begin { turn