[llvm] c005518 - [LoopNest] Allow empty basic blocks without loops
Whitney T Tsang via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 5 08:27:22 PST 2021
Good point. Let me add the include and use the other all_of.
From: Florian Hahn <florian_hahn at apple.com>
To: Whitney Tsang <whitneyt at ca.ibm.com>, Whitney Tsang
<llvmlistbot at llvm.org>
Cc: llvm-commits at lists.llvm.org
Date: 2021/01/05 11:11 AM
Subject: [EXTERNAL] Re: [llvm] c005518 - [LoopNest] Allow empty basic
blocks without loops
> On Jan 5, 2021, at 15:10, Whitney Tsang via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Whitney Tsang
> Date: 2021-01-05T15:09:38Z
> New Revision: c00551893674d6d61e9e5d68412e2b8621f617b8
>
> URL:
https://github.com/llvm/llvm-project/commit/c00551893674d6d61e9e5d68412e2b8621f617b8
> DIFF:
https://github.com/llvm/llvm-project/commit/c00551893674d6d61e9e5d68412e2b8621f617b8.diff
>
> LOG: [LoopNest] Allow empty basic blocks without loops
>
> Allow loop nests with empty basic blocks without loops in different
> levels as perfect.
>
> Reviewers: Meinersbur
>
> Differential Revision:
https://reviews.llvm.org/D93665
>
> Added:
>
>
> Modified:
> llvm/include/llvm/Analysis/LoopNestAnalysis.h
> llvm/lib/Analysis/LoopNestAnalysis.cpp
> llvm/test/Analysis/LoopNestAnalysis/perfectnest.ll
>
> Removed:
>
>
>
>
################################################################################
> diff --git a/llvm/include/llvm/Analysis/LoopNestAnalysis.h
b/llvm/include/llvm/Analysis/LoopNestAnalysis.h
> index 4d77d735819f..f65ff493574c 100644
> --- a/llvm/include/llvm/Analysis/LoopNestAnalysis.h
> +++ b/llvm/include/llvm/Analysis/LoopNestAnalysis.h
> @@ -59,6 +59,12 @@ class LoopNest {
> /// getMaxPerfectDepth(Loop_i) would return 2.
> static unsigned getMaxPerfectDepth(const Loop &Root, ScalarEvolution
&SE);
>
> + /// Recursivelly traverse all empty 'single successor' basic blocks of
\p From
> + /// (if there are any). Return the last basic block found or \p End if
it was
> + /// reached during the search.
> + static const BasicBlock &skipEmptyBlockUntil(const BasicBlock *From,
> + const BasicBlock *End);
> +
> /// Return the outermost loop in the loop nest.
> Loop &getOutermostLoop() const { return *Loops.front(); }
>
> @@ -128,6 +134,12 @@ class LoopNest {
> [](const Loop *L) { return L->isLoopSimplifyForm
(); });
> }
>
> + /// Return true if all loops in the loop nest are in rotated form.
> + bool areAllLoopsRotatedForm() const {
> + return std::all_of(Loops.begin(), Loops.end(),
> + [](const Loop *L) { return L->isRotatedForm
(); });
> + }
> +
Can this just use the all_of version which takes an iterator range from
STLExtras.h? (Same as the areAllLoopsSimpliftForm just above).
Also, this seems to be missing an include for the definition of either
std::all_of or STLExtras.h, which could cause issues for builds with C++
modules.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210105/9eb5dafc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210105/9eb5dafc/attachment.gif>
More information about the llvm-commits
mailing list