diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index c3e9c185be9..6f69a0f0bd3 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1384,7 +1384,7 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, // Try searching forwards from Before, looking for reads or defs. const_iterator I(Before); for (; I != end() && N > 0; ++I) { - if (I->isDebugInstr()) + if (I->isMetaInstruction()) continue; --N; @@ -1423,7 +1423,7 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, do { --I; - if (I->isDebugInstr()) + if (I->isMetaInstruction()) continue; --N; @@ -1456,6 +1456,11 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, } while (I != begin() && N > 0); } + // Check for the edge condition where the only instructions between I and + // begin() are meta instructions. + if (I != begin() && std::prev(I)->isMetaInstruction()) + I = skipMetaInstructionsBackward(std::prev(I), begin()); + // Did we get to the start of the block? if (I == begin()) { // If so, the register's state is definitely defined by the live-in state. diff --git a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp index c307700e70b..3dcc1015dc7 100644 --- a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp +++ b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp @@ -408,7 +408,7 @@ void X86AvoidSFBPass::buildCopy(MachineInstr *LoadInst, unsigned NLoadOpcode, // If the load and store are consecutive, use the loadInst location to // reduce register pressure. MachineInstr *StInst = StoreInst; - auto PrevInstrIt = skipMetaInstructionsBackward( + auto PrevInstrIt = skipDebugInstructionsBackward( std::prev(MachineBasicBlock::instr_iterator(StoreInst)), MBB->instr_begin()); if (PrevInstrIt.getNodePtr() == LoadInst) @@ -496,7 +496,7 @@ void X86AvoidSFBPass::buildCopies(int Size, MachineInstr *LoadInst, static void updateKillStatus(MachineInstr *LoadInst, MachineInstr *StoreInst) { MachineOperand &LoadBase = getBaseOperand(LoadInst); MachineOperand &StoreBase = getBaseOperand(StoreInst); - auto StorePrevNonMetaInstr = skipMetaInstructionsBackward( + auto StorePrevNonDbgInstr = skipDebugInstructionsBackward( std::prev(MachineBasicBlock::instr_iterator(StoreInst)), LoadInst->getParent()->instr_begin()).getNodePtr(); if (LoadBase.isReg()) { @@ -505,13 +505,13 @@ static void updateKillStatus(MachineInstr *LoadInst, MachineInstr *StoreInst) { // then the partial copies were also created in // a consecutive order to reduce register pressure, // and the location of the last load is before the last store. - if (StorePrevNonMetaInstr == LoadInst) + if (StorePrevNonDbgInstr == LoadInst) LastLoad = LoadInst->getPrevNode()->getPrevNode(); getBaseOperand(LastLoad).setIsKill(LoadBase.isKill()); } if (StoreBase.isReg()) { MachineInstr *StInst = StoreInst; - if (StorePrevNonMetaInstr == LoadInst) + if (StorePrevNonDbgInstr == LoadInst) StInst = LoadInst; getBaseOperand(StInst->getPrevNode()).setIsKill(StoreBase.isKill()); } |