diff options
author | Nadav Rotem <nrotem@apple.com> | 2012-09-10 08:44:15 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2012-09-10 08:44:15 +0000 |
commit | 28e6f8c1fc5e9f4de6a999dba37a06ec727ad0bf (patch) | |
tree | 08466833226b5ffdba78043f29028984d6af6917 /llvm/lib | |
parent | d753a952ca10346c9496911aaf25b6dbbe6f2d11 (diff) | |
download | bcm5719-llvm-28e6f8c1fc5e9f4de6a999dba37a06ec727ad0bf.tar.gz bcm5719-llvm-28e6f8c1fc5e9f4de6a999dba37a06ec727ad0bf.zip |
Add an assertion that the frame index is indeed inside the declared lifetime region.
llvm-svn: 163495
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/StackColoring.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp index e1fc52d662f..9d807bbdd88 100644 --- a/llvm/lib/CodeGen/StackColoring.cpp +++ b/llvm/lib/CodeGen/StackColoring.cpp @@ -454,6 +454,11 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) { for (BB = MF->begin(), BBE = MF->end(); BB != BBE; ++BB) for (I = BB->begin(), IE = BB->end(); I != IE; ++I) { + // Skip lifetime markers. We'll remove them soon. + if (I->getOpcode() == TargetOpcode::LIFETIME_START || + I->getOpcode() == TargetOpcode::LIFETIME_END) + continue; + // Update the MachineMemOperand to use the new alloca. for (MachineInstr::mmo_iterator MM = I->memoperands_begin(), E = I->memoperands_end(); MM != E; ++MM) { @@ -491,6 +496,17 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) { if (!SlotRemap.count(FromSlot)) continue; + // In a debug build, check that the instruction that we are check is + // inside its expected live range. If the instruction is not inside + // the calculated range then it means that the alloca usage moved + // outside of the lifetime markers. +#ifndef NDEBUG + SlotIndex Index = Indexes->getInstructionIndex(I); + LiveInterval* Interval = Intervals[FromSlot]; + assert(Interval->find(Index) != Interval->end() && + "Found instruction usage outside of live range."); +#endif + // Fix the machine instructions. int ToSlot = SlotRemap[FromSlot]; MO.setIndex(ToSlot); |