<html><body><p><font size="2">Good point. Let me add the include and use the other all_of.</font><br><br><img width="16" height="16" src="cid:1__=8FBB0CC7DFC9B98C8f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Florian Hahn ---2021/01/05 11:11:42 AM---> On Jan 5, 2021, at 15:10, Whitney Tsang via llvm-commits <"><font size="2" color="#424282">Florian Hahn ---2021/01/05 11:11:42 AM---> On Jan 5, 2021, at 15:10, Whitney Tsang via llvm-commits <llvm-commits@lists.llvm.org> wrote: ></font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Florian Hahn <florian_hahn@apple.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Whitney Tsang <whitneyt@ca.ibm.com>, Whitney Tsang <llvmlistbot@llvm.org></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">llvm-commits@lists.llvm.org</font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">2021/01/05 11:11 AM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">[EXTERNAL] Re: [llvm] c005518 - [LoopNest] Allow empty basic blocks without loops</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt><font size="2"><br><br>> On Jan 5, 2021, at 15:10, Whitney Tsang via llvm-commits <llvm-commits@lists.llvm.org> wrote:<br>> <br>> <br>> Author: Whitney Tsang<br>> Date: 2021-01-05T15:09:38Z<br>> New Revision: c00551893674d6d61e9e5d68412e2b8621f617b8<br>> <br>> URL: </font></tt><tt><font size="2"><a href="https://github.com/llvm/llvm-project/commit/c00551893674d6d61e9e5d68412e2b8621f617b8">https://github.com/llvm/llvm-project/commit/c00551893674d6d61e9e5d68412e2b8621f617b8</a></font></tt><tt><font size="2"> <br>> DIFF: </font></tt><tt><font size="2"><a href="https://github.com/llvm/llvm-project/commit/c00551893674d6d61e9e5d68412e2b8621f617b8.diff">https://github.com/llvm/llvm-project/commit/c00551893674d6d61e9e5d68412e2b8621f617b8.diff</a></font></tt><tt><font size="2"> <br>> <br>> LOG: [LoopNest] Allow empty basic blocks without loops<br>> <br>> Allow loop nests with empty basic blocks without loops in different<br>> levels as perfect.<br>> <br>> Reviewers: Meinersbur<br>> <br>> Differential Revision: </font></tt><tt><font size="2"><a href="https://reviews.llvm.org/D93665">https://reviews.llvm.org/D93665</a></font></tt><tt><font size="2"> <br>> <br>> Added: <br>> <br>> <br>> Modified: <br>>    llvm/include/llvm/Analysis/LoopNestAnalysis.h<br>>    llvm/lib/Analysis/LoopNestAnalysis.cpp<br>>    llvm/test/Analysis/LoopNestAnalysis/perfectnest.ll<br>> <br>> Removed: <br>> <br>> <br>> <br>> ################################################################################<br>> diff  --git a/llvm/include/llvm/Analysis/LoopNestAnalysis.h b/llvm/include/llvm/Analysis/LoopNestAnalysis.h<br>> index 4d77d735819f..f65ff493574c 100644<br>> --- a/llvm/include/llvm/Analysis/LoopNestAnalysis.h<br>> +++ b/llvm/include/llvm/Analysis/LoopNestAnalysis.h<br>> @@ -59,6 +59,12 @@ class LoopNest {<br>>   /// getMaxPerfectDepth(Loop_i) would return 2.<br>>   static unsigned getMaxPerfectDepth(const Loop &Root, ScalarEvolution &SE);<br>> <br>> +  /// Recursivelly traverse all empty 'single successor' basic blocks of \p From<br>> +  /// (if there are any). Return the last basic block found or \p End if it was<br>> +  /// reached during the search.<br>> +  static const BasicBlock &skipEmptyBlockUntil(const BasicBlock *From,<br>> +                                               const BasicBlock *End);<br>> +<br>>   /// Return the outermost loop in the loop nest.<br>>   Loop &getOutermostLoop() const { return *Loops.front(); }<br>> <br>> @@ -128,6 +134,12 @@ class LoopNest {<br>>                         [](const Loop *L) { return L->isLoopSimplifyForm(); });<br>>   }<br>> <br>> +  /// Return true if all loops in the loop nest are in rotated form.<br>> +  bool areAllLoopsRotatedForm() const {<br>> +    return std::all_of(Loops.begin(), Loops.end(),<br>> +                       [](const Loop *L) { return L->isRotatedForm(); });<br>> +  }<br>> +<br><br>Can this just use the all_of version which takes an iterator range from STLExtras.h? (Same as the areAllLoopsSimpliftForm just above). <br><br>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.<br></font></tt><br><br><BR>
</body></html>