[PATCH] D93336: [PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 13:12:57 PST 2020


jsji created this revision.
jsji added reviewers: PowerPC, shchenz, steven.zhang.
Herald added subscribers: NickHung, kbarton, hiraditya, tschuett, nemanjai.
jsji requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The PPCCTRLoop pass has been moved to HardwareLoops,
so the comments and come code are deprecated now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93336

Files:
  llvm/lib/Target/PowerPC/PPCCTRLoops.cpp


Index: llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
+++ llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
@@ -1,4 +1,4 @@
-//===-- PPCCTRLoops.cpp - Identify and generate CTR loops -----------------===//
+//===-- PPCCTRLoops.cpp - Verify CTR loops -----------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,19 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This pass identifies loops where we can generate the PPC branch instructions
-// that decrement and test the count register (CTR) (bdnz and friends).
-//
-// The pattern that defines the induction variable can changed depending on
-// prior optimizations.  For example, the IndVarSimplify phase run by 'opt'
-// normalizes induction variables, and the Loop Strength Reduction pass
-// run by 'llc' may also make changes to the induction variable.
-//
-// Criteria for CTR loops:
-//  - Countable loops (w/ ind. var for a trip count)
-//  - Try inner-most loops first
-//  - No nested CTR loops.
-//  - No function calls in loops.
+// This pass verifies that all bdnz/bdz instructions are dominated by a loop
+// mtctr before any other instructions that might clobber the ctr register.
 //
 //===----------------------------------------------------------------------===//
 
@@ -65,15 +54,11 @@
 
 using namespace llvm;
 
-#define DEBUG_TYPE "ctrloops"
+#define DEBUG_TYPE "ppc-ctrloops-verify"
 
 #ifndef NDEBUG
-static cl::opt<int> CTRLoopLimit("ppc-max-ctrloop", cl::Hidden, cl::init(-1));
-#endif
-
 namespace {
 
-#ifndef NDEBUG
   struct PPCCTRLoopsVerify : public MachineFunctionPass {
   public:
     static char ID;
@@ -94,10 +79,8 @@
   };
 
   char PPCCTRLoopsVerify::ID = 0;
-#endif // NDEBUG
 } // end anonymous namespace
 
-#ifndef NDEBUG
 INITIALIZE_PASS_BEGIN(PPCCTRLoopsVerify, "ppc-ctr-loops-verify",
                       "PowerPC CTR Loops Verify", false, false)
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
@@ -107,9 +90,7 @@
 FunctionPass *llvm::createPPCCTRLoopsVerify() {
   return new PPCCTRLoopsVerify();
 }
-#endif // NDEBUG
 
-#ifndef NDEBUG
 static bool clobbersCTR(const MachineInstr &MI) {
   for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = MI.getOperand(i);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93336.312012.patch
Type: text/x-patch
Size: 2466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201215/8d8ee905/attachment.bin>


More information about the llvm-commits mailing list