diff options
author | Adam Nemet <anemet@apple.com> | 2017-01-25 23:20:33 +0000 |
---|---|---|
committer | Adam Nemet <anemet@apple.com> | 2017-01-25 23:20:33 +0000 |
commit | a964066705b2d11a62a66d88d1ef46680eea9540 (patch) | |
tree | 4a7d9a5ef0cacebf1af7a7936cd330ea3e535a8a /llvm/lib/CodeGen/MachineLoopInfo.cpp | |
parent | 484f93db30367766642f6688c841497bec8bf42d (diff) | |
download | bcm5719-llvm-a964066705b2d11a62a66d88d1ef46680eea9540.tar.gz bcm5719-llvm-a964066705b2d11a62a66d88d1ef46680eea9540.zip |
New OptimizationRemarkEmitter pass for MIR
This allows MIR passes to emit optimization remarks with the same level
of functionality that is available to IR passes.
It also hooks up the greedy register allocator to report spills. This
allows for interesting use cases like increasing interleaving on a loop
until spilling of registers is observed.
I still need to experiment whether reporting every spill scales but this
demonstrates for now that the functionality works from llc
using -pass-remarks*=<pass>.
Differential Revision: https://reviews.llvm.org/D29004
llvm-svn: 293110
Diffstat (limited to 'llvm/lib/CodeGen/MachineLoopInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineLoopInfo.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineLoopInfo.cpp b/llvm/lib/CodeGen/MachineLoopInfo.cpp index fdeaf7b7116..a9aa1d954e7 100644 --- a/llvm/lib/CodeGen/MachineLoopInfo.cpp +++ b/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 { |