Rename inst_range() to instructions() for consistency. NFC
authorNico Rieck <nico.rieck@gmail.com>
Thu, 6 Aug 2015 19:10:45 +0000 (19:10 +0000)
committerNico Rieck <nico.rieck@gmail.com>
Thu, 6 Aug 2015 19:10:45 +0000 (19:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244248 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
include/llvm/IR/InstIterator.h
lib/Analysis/DivergenceAnalysis.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/MemDepPrinter.cpp
lib/Analysis/MemDerefPrinter.cpp
lib/CodeGen/InterleavedAccessPass.cpp
lib/Target/AArch64/AArch64PromoteConstant.cpp
lib/Transforms/Instrumentation/SafeStack.cpp
lib/Transforms/Scalar/ADCE.cpp
lib/Transforms/Scalar/BDCE.cpp
lib/Transforms/Scalar/Float2Int.cpp
lib/Transforms/Scalar/PlaceSafepoints.cpp
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

index f3ce6490fb66691505d4e903cfd9eeb1b999a089..40f66c8d98baf7302ace12a4ce7ec3afeaa97ae4 100644 (file)
@@ -123,11 +123,13 @@ typedef InstIterator<const iplist<BasicBlock>,
                      Function::const_iterator,
                      BasicBlock::const_iterator,
                      const Instruction> const_inst_iterator;
+typedef iterator_range<inst_iterator> inst_range;
+typedef iterator_range<const_inst_iterator> const_inst_range;
 
 inline inst_iterator inst_begin(Function *F) { return inst_iterator(*F); }
 inline inst_iterator inst_end(Function *F)   { return inst_iterator(*F, true); }
-inline iterator_range<inst_iterator> inst_range(Function *F) {
-  return iterator_range<inst_iterator>(inst_begin(F), inst_end(F));
+inline inst_range instructions(Function *F) {
+  return inst_range(inst_begin(F), inst_end(F));
 }
 inline const_inst_iterator inst_begin(const Function *F) {
   return const_inst_iterator(*F);
@@ -135,13 +137,13 @@ inline const_inst_iterator inst_begin(const Function *F) {
 inline const_inst_iterator inst_end(const Function *F) {
   return const_inst_iterator(*F, true);
 }
-inline iterator_range<const_inst_iterator> inst_range(const Function *F) {
-  return iterator_range<const_inst_iterator>(inst_begin(F), inst_end(F));
+inline const_inst_range instructions(const Function *F) {
+  return const_inst_range(inst_begin(F), inst_end(F));
 }
 inline inst_iterator inst_begin(Function &F) { return inst_iterator(F); }
 inline inst_iterator inst_end(Function &F)   { return inst_iterator(F, true); }
-inline iterator_range<inst_iterator> inst_range(Function &F) {
-  return iterator_range<inst_iterator>(inst_begin(F), inst_end(F));
+inline inst_range instructions(Function &F) {
+  return inst_range(inst_begin(F), inst_end(F));
 }
 inline const_inst_iterator inst_begin(const Function &F) {
   return const_inst_iterator(F);
@@ -149,8 +151,8 @@ inline const_inst_iterator inst_begin(const Function &F) {
 inline const_inst_iterator inst_end(const Function &F) {
   return const_inst_iterator(F, true);
 }
-inline iterator_range<const_inst_iterator> inst_range(const Function &F) {
-  return iterator_range<const_inst_iterator>(inst_begin(F), inst_end(F));
+inline const_inst_range instructions(const Function &F) {
+  return const_inst_range(inst_begin(F), inst_end(F));
 }
 
 } // End llvm namespace
index e5ee2959c15d9e6c99e529ae7cf54fcc10a042a4..f3fc7844020e66685b8aec5c590287486fe7a452 100644 (file)
@@ -159,7 +159,7 @@ private:
 void DivergencePropagator::populateWithSourcesOfDivergence() {
   Worklist.clear();
   DV.clear();
-  for (auto &I : inst_range(F)) {
+  for (auto &I : instructions(F)) {
     if (TTI.isSourceOfDivergence(&I)) {
       Worklist.push_back(&I);
       DV.insert(&I);
@@ -329,8 +329,8 @@ void DivergenceAnalysis::print(raw_ostream &OS, const Module *) const {
     if (DivergentValues.count(&Arg))
       OS << "DIVERGENT:  " << Arg << "\n";
   }
-  // Iterate instructions using inst_range to ensure a deterministic order.
-  for (auto &I : inst_range(F)) {
+  // Iterate instructions using instructions() to ensure a deterministic order.
+  for (auto &I : instructions(F)) {
     if (DivergentValues.count(&I))
       OS << "DIVERGENT:" << I << "\n";
   }
index 4345f6b681358fec906f97c99c04a94751c7ff2d..f7b55c2cf8fe6e5cc84a8210d4fc96547e971f08 100644 (file)
@@ -627,7 +627,7 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
     for (auto *Node : SCC) {
       if (FI.getModRefInfo() == MRI_ModRef)
         break; // The mod/ref lattice saturates here.
-      for (Instruction &I : inst_range(Node->getFunction())) {
+      for (Instruction &I : instructions(Node->getFunction())) {
         if (FI.getModRefInfo() == MRI_ModRef)
           break; // The mod/ref lattice saturates here.
 
index da3b829b6d31fd8b4c355f0b9944f0b86da05ef8..4d7c9b040b582dc7b033faf8d7e5700651cd6c56 100644 (file)
@@ -96,7 +96,7 @@ bool MemDepPrinter::runOnFunction(Function &F) {
 
   // All this code uses non-const interfaces because MemDep is not
   // const-friendly, though nothing is actually modified.
-  for (auto &I : inst_range(F)) {
+  for (auto &I : instructions(F)) {
     Instruction *Inst = &I;
 
     if (!Inst->mayReadFromMemory() && !Inst->mayWriteToMemory())
@@ -135,7 +135,7 @@ bool MemDepPrinter::runOnFunction(Function &F) {
 }
 
 void MemDepPrinter::print(raw_ostream &OS, const Module *M) const {
-  for (const auto &I : inst_range(*F)) {
+  for (const auto &I : instructions(*F)) {
     const Instruction *Inst = &I;
 
     DepSetMap::const_iterator DI = Deps.find(Inst);
index fa292a28ec87c13701cefeec0652133e677d7440..ef2de41e120921a5eeaf50681e659d3b0bbda8ff 100644 (file)
@@ -51,7 +51,7 @@ FunctionPass *llvm::createMemDerefPrinter() {
 
 bool MemDerefPrinter::runOnFunction(Function &F) {
   const DataLayout &DL = F.getParent()->getDataLayout();
-  for (auto &I: inst_range(F)) {
+  for (auto &I: instructions(F)) {
     if (LoadInst *LI = dyn_cast<LoadInst>(&I)) {
       Value *PO = LI->getPointerOperand();
       if (isDereferenceablePointer(PO, DL))
index 53c8adc05d779f2bda1521a3e853ecdd34c8a1fe..baacf1ad9e17e5b8b0cf32bbd415c1b6bb4b8e8e 100644 (file)
@@ -271,7 +271,7 @@ bool InterleavedAccess::runOnFunction(Function &F) {
   SmallVector<Instruction *, 32> DeadInsts;
   bool Changed = false;
 
-  for (auto &I : inst_range(F)) {
+  for (auto &I : instructions(F)) {
     if (LoadInst *LI = dyn_cast<LoadInst>(&I))
       Changed |= lowerInterleavedLoad(LI, DeadInsts);
 
index e1b93bf07c890dd5f5c1998fb5922b9d0cc5b621..74b2e2fb88b1631fc5725356680ee6b6a3362f1f 100644 (file)
@@ -540,7 +540,7 @@ bool AArch64PromoteConstant::runOnFunction(Function &F) {
   bool LocalChange = false;
   SmallPtrSet<Constant *, 8> AlreadyChecked;
 
-  for (Instruction &I : inst_range(&F)) {
+  for (Instruction &I : instructions(&F)) {
     // Traverse the operand, looking for constant vectors. Replace them by a
     // load of a global variable of constant vector type.
     for (Value *Op : I.operand_values()) {
index 6b185a2b127b92f700a6e6ee65e2628bd269a876..ac2775b63979f87e3f26f4c5839f33dad4bf1bb0 100644 (file)
@@ -275,7 +275,7 @@ void SafeStack::findInsts(Function &F,
                           SmallVectorImpl<AllocaInst *> &DynamicAllocas,
                           SmallVectorImpl<ReturnInst *> &Returns,
                           SmallVectorImpl<Instruction *> &StackRestorePoints) {
-  for (Instruction &I : inst_range(&F)) {
+  for (Instruction &I : instructions(&F)) {
     if (auto AI = dyn_cast<AllocaInst>(&I)) {
       ++NumAllocas;
 
index 824342ad7e38198c220bb94ed6445768f13e1f2b..96a0107ce18f4fa424d387faef34652627a042a1 100644 (file)
@@ -57,7 +57,7 @@ bool ADCE::runOnFunction(Function& F) {
   SmallVector<Instruction*, 128> Worklist;
 
   // Collect the set of "root" instructions that are known live.
-  for (Instruction &I : inst_range(F)) {
+  for (Instruction &I : instructions(F)) {
     if (isa<TerminatorInst>(I) || isa<DbgInfoIntrinsic>(I) || I.isEHPad() ||
         I.mayHaveSideEffects()) {
       Alive.insert(&I);
@@ -79,7 +79,7 @@ bool ADCE::runOnFunction(Function& F) {
   // which have no side effects and do not influence the control flow or return
   // value of the function, and may therefore be deleted safely.
   // NOTE: We reuse the Worklist vector here for memory efficiency.
-  for (Instruction &I : inst_range(F)) {
+  for (Instruction &I : instructions(F)) {
     if (!Alive.count(&I)) {
       Worklist.push_back(&I);
       I.dropAllReferences();
index 7252db0a6cdcddf4b0551656e6f059c3fb219f3b..909a86f740b8a5677ef2600231c1d8f0c0ff7977 100644 (file)
@@ -272,7 +272,7 @@ bool BDCE::runOnFunction(Function& F) {
   SmallPtrSet<Instruction*, 128> Visited;
 
   // Collect the set of "root" instructions that are known live.
-  for (Instruction &I : inst_range(F)) {
+  for (Instruction &I : instructions(F)) {
     if (!isAlwaysLive(&I))
       continue;
 
@@ -365,7 +365,7 @@ bool BDCE::runOnFunction(Function& F) {
   // which have no side effects and do not influence the control flow or return
   // value of the function, and may therefore be deleted safely.
   // NOTE: We reuse the Worklist vector here for memory efficiency.
-  for (Instruction &I : inst_range(F)) {
+  for (Instruction &I : instructions(F)) {
     // For live instructions that have all dead bits, first make them dead by
     // replacing all uses with something else. Then, if they don't need to
     // remain live (because they have side effects, etc.) we can remove them.
index 8c1dce1c9fb59fd741acf51761d57363f5d3b4cd..f52c32b97212fe3cfed440a181e7feefdb67656c 100644 (file)
@@ -127,7 +127,7 @@ static Instruction::BinaryOps mapBinOpcode(unsigned Opcode) {
 // Find the roots - instructions that convert from the FP domain to
 // integer domain.
 void Float2Int::findRoots(Function &F, SmallPtrSet<Instruction*,8> &Roots) {
-  for (auto &I : inst_range(F)) {
+  for (auto &I : instructions(F)) {
     switch (I.getOpcode()) {
     default: break;
     case Instruction::FPToUI:
index 098e6eff15f7602b352dae0581c0c8fe7f4fca0c..d6a48c783b4a1ccf25b661595fbe117bef84b194 100644 (file)
@@ -466,7 +466,7 @@ static Instruction *findLocationForEntrySafepoint(Function &F,
 static void findCallSafepoints(Function &F,
                                std::vector<CallSite> &Found /*rval*/) {
   assert(Found.empty() && "must be empty!");
-  for (Instruction &I : inst_range(F)) {
+  for (Instruction &I : instructions(F)) {
     Instruction *inst = &I;
     if (isa<CallInst>(inst) || isa<InvokeInst>(inst)) {
       CallSite CS(inst);
index 53975e254b120ec0a525cbd02002e224fffa0578..6f70147c2a00cace548ed019bd4264ae622939f1 100644 (file)
@@ -2310,7 +2310,7 @@ void RewriteStatepointsForGC::stripDereferenceabilityInfoFromBody(Function &F) {
   LLVMContext &Ctx = F.getContext();
   MDBuilder Builder(Ctx);
 
-  for (Instruction &I : inst_range(F)) {
+  for (Instruction &I : instructions(F)) {
     if (const MDNode *MD = I.getMetadata(LLVMContext::MD_tbaa)) {
       assert(MD->getNumOperands() < 5 && "unrecognized metadata shape!");
       bool IsImmutableTBAA =
@@ -2384,7 +2384,7 @@ bool RewriteStatepointsForGC::runOnFunction(Function &F) {
   // when rewriting.  We'll delete the unreachable ones in a moment.
   SmallVector<CallSite, 64> ParsePointNeeded;
   bool HasUnreachableStatepoint = false;
-  for (Instruction &I : inst_range(F)) {
+  for (Instruction &I : instructions(F)) {
     // TODO: only the ones with the flag set!
     if (isStatepoint(I)) {
       if (DT.isReachableFromEntry(I.getParent()))