diff --git a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp --- a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp +++ b/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 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);