[llvm] 03da6e8 - [ModuloSchedule] Do target loop analysis before peeling.

Thomas Raoux via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 09:35:57 PST 2019


Author: Thomas Raoux
Date: 2019-11-11T09:35:39-08:00
New Revision: 03da6e8c00de2320e6b9dacba8f7850faceae319

URL: https://github.com/llvm/llvm-project/commit/03da6e8c00de2320e6b9dacba8f7850faceae319
DIFF: https://github.com/llvm/llvm-project/commit/03da6e8c00de2320e6b9dacba8f7850faceae319.diff

LOG:     [ModuloSchedule] Do target loop analysis before peeling.

    Simple change to call target hook analyzeLoopForPipelining before
    changing the loop. After peeling analyzing the loop may be more
    complicated for target that don't have a loop instruction. This doesn't
    affect Hexagone and PPC as they have hardware loop instructions.

    Differential Revision: https://reviews.llvm.org/D69912

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/ModuloSchedule.h
    llvm/lib/CodeGen/ModuloSchedule.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/ModuloSchedule.h b/llvm/include/llvm/CodeGen/ModuloSchedule.h
index 81a9b63b64ca..f3b2424bd684 100644
--- a/llvm/include/llvm/CodeGen/ModuloSchedule.h
+++ b/llvm/include/llvm/CodeGen/ModuloSchedule.h
@@ -342,6 +342,8 @@ class PeelingModuloScheduleExpander {
       MI = CanonicalMIs[MI];
     return Schedule.getStage(MI);
   }
+  /// Target loop info before kernel peeling.
+  std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo> Info;
 };
 
 /// Expander that simply annotates each scheduled instruction with a post-instr

diff  --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp
index 7ce3c5861801..98de0816f27c 100644
--- a/llvm/lib/CodeGen/ModuloSchedule.cpp
+++ b/llvm/lib/CodeGen/ModuloSchedule.cpp
@@ -1759,10 +1759,6 @@ void PeelingModuloScheduleExpander::rewriteUsesOf(MachineInstr *MI) {
 }
 
 void PeelingModuloScheduleExpander::fixupBranches() {
-  std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo> Info =
-      TII->analyzeLoopForPipelining(BB);
-  assert(Info);
-
   // Work outwards from the kernel.
   bool KernelDisposed = false;
   int TC = Schedule.getNumStages() - 1;
@@ -1818,6 +1814,8 @@ void PeelingModuloScheduleExpander::expand() {
   BB = Schedule.getLoop()->getTopBlock();
   Preheader = Schedule.getLoop()->getLoopPreheader();
   LLVM_DEBUG(Schedule.dump());
+  Info = TII->analyzeLoopForPipelining(BB);
+  assert(Info);
 
   rewriteKernel();
   peelPrologAndEpilogs();


        


More information about the llvm-commits mailing list