diff options
Diffstat (limited to 'contrib/llvm/lib/CodeGen/MachineLoopInfo.cpp')
| -rw-r--r-- | contrib/llvm/lib/CodeGen/MachineLoopInfo.cpp | 16 | 
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/llvm/lib/CodeGen/MachineLoopInfo.cpp b/contrib/llvm/lib/CodeGen/MachineLoopInfo.cpp index fdeaf7b71161..a9aa1d954e70 100644 --- a/contrib/llvm/lib/CodeGen/MachineLoopInfo.cpp +++ b/contrib/llvm/lib/CodeGen/MachineLoopInfo.cpp @@ -87,6 +87,22 @@ MachineBasicBlock *MachineLoop::findLoopControlBlock() {    return nullptr;  } +DebugLoc MachineLoop::getStartLoc() const { +  // Try the pre-header first. +  if (MachineBasicBlock *PHeadMBB = getLoopPreheader()) +    if (const BasicBlock *PHeadBB = PHeadMBB->getBasicBlock()) +      if (DebugLoc DL = PHeadBB->getTerminator()->getDebugLoc()) +        return DL; + +  // If we have no pre-header or there are no instructions with debug +  // info in it, try the header. +  if (MachineBasicBlock *HeadMBB = getHeader()) +    if (const BasicBlock *HeadBB = HeadMBB->getBasicBlock()) +      return HeadBB->getTerminator()->getDebugLoc(); + +  return DebugLoc(); +} +  MachineBasicBlock *  MachineLoopInfo::findLoopPreheader(MachineLoop *L,                                     bool SpeculativePreheader) const {  | 
