mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Fix many regressions on x86 by avoiding dereferencing the end iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42738 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f8a3ee1d63
commit
eac9385f09
@ -1481,7 +1481,8 @@ void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
||||
static
|
||||
void mergeSPUpdatesUp(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
||||
unsigned StackPtr, uint64_t *NumBytes = NULL) {
|
||||
if (MBBI != MBB.begin()) {
|
||||
if (MBBI == MBB.begin()) return;
|
||||
|
||||
MachineBasicBlock::iterator PI = prior(MBBI);
|
||||
unsigned Opc = PI->getOpcode();
|
||||
if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 ||
|
||||
@ -1498,14 +1499,17 @@ void mergeSPUpdatesUp(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
||||
MBB.erase(PI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// mergeSPUpdatesUp - Merge two stack-manipulating instructions lower iterator.
|
||||
static
|
||||
void mergeSPUpdatesDown(MachineBasicBlock &MBB,MachineBasicBlock::iterator &MBBI,
|
||||
void mergeSPUpdatesDown(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator &MBBI,
|
||||
unsigned StackPtr, uint64_t *NumBytes = NULL) {
|
||||
if (MBBI != MBB.end()) {
|
||||
if (MBBI == MBB.end()) return;
|
||||
|
||||
MachineBasicBlock::iterator NI = next(MBBI);
|
||||
if (NI == MBB.end()) return;
|
||||
|
||||
unsigned Opc = NI->getOpcode();
|
||||
if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 ||
|
||||
Opc == X86::ADD32ri || Opc == X86::ADD32ri8) &&
|
||||
@ -1523,7 +1527,6 @@ void mergeSPUpdatesDown(MachineBasicBlock &MBB,MachineBasicBlock::iterator &MBBI
|
||||
MBBI = NI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
|
||||
|
Loading…
Reference in New Issue
Block a user