* x86: Fixed attributes of the LEAVE instruction - it reads EBP.

This fixes crashes with -O3s in some cases due to an incorrect peephole
  optimization.
This commit is contained in:
Yuriy Sydorov 2021-09-15 22:29:43 +03:00
parent e121a753e1
commit 4a7a113a30
5 changed files with 5 additions and 4 deletions

View File

@ -169,7 +169,7 @@
(Ch: [Ch_All]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: [Ch_RWESP, Ch_WEBP]),
(Ch: [Ch_RWESP, Ch_RWEBP]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: []),

View File

@ -169,7 +169,7 @@
(Ch: [Ch_All]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: [Ch_RWESP, Ch_WEBP]),
(Ch: [Ch_RWESP, Ch_RWEBP]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: []),

View File

@ -3229,6 +3229,7 @@ unit aoptx86;
RegLoadedWithNewValue(CurrentReg, hp2) or
not RegUsedAfterInstruction(CurrentReg, hp2, TmpUsedRegs) then
begin
RegUsedAfterInstruction(CurrentReg, hp2, TmpUsedRegs);
{ We can remove the original MOV }
DebugMsg(SPeepholeOptimization + 'Mov2Nop 3b done',p);
RemoveCurrentp(p, hp1);

View File

@ -942,7 +942,7 @@ reg16|32,mem \320\1\xC5\110 8086,NOX86_64
reg16|32|64,mem \320\1\x8D\110 8086
[LEAVE]
(Ch_RWESP, Ch_WEBP)
(Ch_RWESP, Ch_RWEBP)
void \1\xC9 186
[LES,lesX]

View File

@ -160,7 +160,7 @@
(Ch: [Ch_Wop2, Ch_WZeroFlag]),
(Ch: [Ch_All]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: [Ch_RWESP, Ch_WEBP]),
(Ch: [Ch_RWESP, Ch_RWEBP]),
(Ch: [Ch_Wop2, Ch_Rop1]),
(Ch: []),
(Ch: [Ch_Wop2, Ch_Rop1]),