mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
X86: correct tail return address calculation
Due to the weird and wondeful usual arithmetic conversions, some calculations involving negative values were getting performed in uint32_t and then promoted to int64_t, which is really not a good idea. Patch by Katsuhiro Ueno. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187703 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1323,7 +1323,7 @@ X86FrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
unsigned SlotSize = RegInfo->getSlotSize();
|
||||
|
||||
X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
|
||||
int32_t TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
|
||||
int64_t TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
|
||||
|
||||
if (TailCallReturnAddrDelta < 0) {
|
||||
// create RETURNADDR area
|
||||
@ -1336,7 +1336,7 @@ X86FrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
// }
|
||||
// [EBP]
|
||||
MFI->CreateFixedObject(-TailCallReturnAddrDelta,
|
||||
(-1U*SlotSize)+TailCallReturnAddrDelta, true);
|
||||
TailCallReturnAddrDelta - SlotSize, true);
|
||||
}
|
||||
|
||||
if (hasFP(MF)) {
|
||||
|
Reference in New Issue
Block a user