summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-04-29 14:27:31 +0000
committerDiego Novillo <dnovillo@google.com>2014-04-29 14:27:31 +0000
commit44180390f8c484e946e61fa800bfd8cf24d4af30 (patch)
tree9d01ca78a806aabcb64ceb4eb114c5eda3c47969 /include
parentedc45954721e8fb27537319dc276f0b2dddf2863 (diff)
downloadllvm-44180390f8c484e946e61fa800bfd8cf24d4af30.tar.gz
llvm-44180390f8c484e946e61fa800bfd8cf24d4af30.tar.bz2
llvm-44180390f8c484e946e61fa800bfd8cf24d4af30.tar.xz
Add optimization remarks to the loop unroller and vectorizer.
Summary: This calls emitOptimizationRemark from the loop unroller and vectorizer at the point where they make a positive transformation. For the vectorizer, it reports vectorization and interleave factors. For the loop unroller, it reports all the different supported types of unrolling. Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3456 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207528 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/LoopInfo.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 045d4dc565..bef03e91bb 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -453,6 +453,31 @@ public:
void dump() const;
+ /// \brief Return the debug location of the start of this loop.
+ /// This looks for a BB terminating instruction with a known debug
+ /// location by looking at the preheader and header blocks. If it
+ /// cannot find a terminating instruction with location information,
+ /// it returns an unknown location.
+ DebugLoc getStartLoc() const {
+ DebugLoc StartLoc;
+ BasicBlock *HeadBB;
+
+ // Try the pre-header first.
+ if ((HeadBB = getLoopPreheader()) != nullptr) {
+ StartLoc = HeadBB->getTerminator()->getDebugLoc();
+ if (!StartLoc.isUnknown())
+ return StartLoc;
+ }
+
+ // If we have no pre-header or there are no instructions with debug
+ // info in it, try the header.
+ HeadBB = getHeader();
+ if (HeadBB)
+ StartLoc = HeadBB->getTerminator()->getDebugLoc();
+
+ return StartLoc;
+ }
+
private:
friend class LoopInfoBase<BasicBlock, Loop>;
explicit Loop(BasicBlock *BB) : LoopBase<BasicBlock, Loop>(BB) {}