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

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 15:45:43 PST 2016


On Tue, Jan 19, 2016 at 10:26 AM, Philip Reames via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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.
>

Did you intend to write "Note that"? "Not" actually results in the same
overall meaning I think (although a non-native speaker might find it harder
to understand), but it seems like "Note" was intended.

-- Sean Silva


>  class Loop : public LoopBase<BasicBlock, Loop> {
>  public:
>    Loop() {}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160120/c3692546/attachment.html>


More information about the llvm-commits mailing list