[llvm] r258154 - Add clarifying comments defining what a Loop is

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 10:26:04 PST 2016


Author: reames
Date: Tue Jan 19 12:26:01 2016
New Revision: 258154

URL: http://llvm.org/viewvc/llvm-project?rev=258154&view=rev
Log:
Add clarifying comments defining what a Loop is

Our loop construct is not a way to identify cycles in the CFG.  This wasn't immediately obvious from the header, so clarify that fact.

The motivation for this was that I just fixed a out of tree bug due to a mistaken assumption (on my part) on what a Loop actually was.  While it was fresh in my mind, I wanted to document the key point.


Modified:
    llvm/trunk/include/llvm/Analysis/LoopInfo.h

Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=258154&r1=258153&r2=258154&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Tue Jan 19 12:26:01 2016
@@ -25,6 +25,12 @@
 //  * the loop depth
 //  * etc...
 //
+// Note that this analysis specifically identifies *Loops* not cycles or SCCs
+// in the CFG.  There can be strongly connected compontents in the CFG which
+// this analysis will not recognize and that will not be represented by a Loop
+// instance.  In particular, a Loop might be inside such a non-loop SCC, or a
+// non-loop SCC might contain a sub-SCC which is a Loop. 
+//
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_ANALYSIS_LOOPINFO_H
@@ -346,6 +352,9 @@ raw_ostream& operator<<(raw_ostream &OS,
 // Implementation in LoopInfoImpl.h
 extern template class LoopBase<BasicBlock, Loop>;
 
+
+/// Represents a single loop in the control flow graph.  Not that not all SCCs
+/// in the CFG are neccessarily loops.
 class Loop : public LoopBase<BasicBlock, Loop> {
 public:
   Loop() {}




More information about the llvm-commits mailing list