This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index a582f3b..87a8f02 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -106,7 +106,7 @@
 
   // First check: see if there are any pointer arguments!  If not, quick exit.
   std::vector<Argument*> PointerArgs;
-  for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     if (isa<PointerType>(I->getType()))
       PointerArgs.push_back(I);
   if (PointerArgs.empty()) return false;
@@ -163,7 +163,7 @@
 static bool AllCalleesPassInValidPointerForArgument(Argument *Arg) {
   Function *Callee = Arg->getParent();
 
-  unsigned ArgNo = std::distance(Callee->abegin(), Function::aiterator(Arg));
+  unsigned ArgNo = std::distance(Callee->arg_begin(), Function::arg_iterator(Arg));
 
   // Look at all call sites of the function.  At this pointer we know we only
   // have direct callees.
@@ -347,7 +347,7 @@
   // what the new GEP/Load instructions we are inserting look like.
   std::map<std::vector<Value*>, LoadInst*> OriginalLoads;
 
-  for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     if (!ArgsToPromote.count(I)) {
       Params.push_back(I->getType());
     } else if (I->use_empty()) {
@@ -411,7 +411,7 @@
     // Loop over the operands, inserting GEP and loads in the caller as
     // appropriate.
     CallSite::arg_iterator AI = CS.arg_begin();
-    for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI)
+    for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I, ++AI)
       if (!ArgsToPromote.count(I))
         Args.push_back(*AI);          // Unmodified argument
       else if (!I->use_empty()) {
@@ -470,7 +470,7 @@
   // Loop over the argument list, transfering uses of the old arguments over to
   // the new arguments, also transfering over the names as well.
   //
-  for (Function::aiterator I = F->abegin(), E = F->aend(), I2 = NF->abegin();
+  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), I2 = NF->arg_begin();
        I != E; ++I)
     if (!ArgsToPromote.count(I)) {
       // If this is an unmodified argument, move the name and users over to the
@@ -502,7 +502,7 @@
           std::vector<Value*> Operands(GEP->op_begin()+1, GEP->op_end());
 
           unsigned ArgNo = 0;
-          Function::aiterator TheArg = I2;
+          Function::arg_iterator TheArg = I2;
           for (ScalarizeTable::iterator It = ArgIndices.begin();
                *It != Operands; ++It, ++TheArg) {
             assert(It != ArgIndices.end() && "GEP not handled??");
@@ -539,7 +539,7 @@
 
   // Notify the alias analysis implementation that we inserted a new argument.
   if (ExtraArgHack)
-    AA.copyValue(Constant::getNullValue(Type::IntTy), NF->abegin());
+    AA.copyValue(Constant::getNullValue(Type::IntTy), NF->arg_begin());
 
 
   // Tell the alias analysis that the old function is about to disappear.
diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp
index 27e1955..0140228 100644
--- a/lib/Transforms/IPO/ConstantMerge.cpp
+++ b/lib/Transforms/IPO/ConstantMerge.cpp
@@ -56,7 +56,7 @@
     // because doing so may cause initializers of other globals to be rewritten,
     // invalidating the Constant* pointers in CMap.
     //
-    for (Module::giterator GV = M.gbegin(), E = M.gend(); GV != E; ++GV)
+    for (Module::global_iterator GV = M.global_begin(), E = M.global_end(); GV != E; ++GV)
       // Only process constants with initializers
       if (GV->isConstant() && GV->hasInitializer()) {
         Constant *Init = GV->getInitializer();
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index e4b7a3e..e226dc3 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -210,7 +210,7 @@
 
   if (FunctionIntrinsicallyLive) {
     DEBUG(std::cerr << "  Intrinsically live fn: " << F.getName() << "\n");
-    for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI)
+    for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI)
       LiveArguments.insert(AI);
     LiveRetVal.insert(&F);
     return;
@@ -230,7 +230,7 @@
   // if there are any arguments we assume that are dead.
   //
   bool AnyMaybeLiveArgs = false;
-  for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI)
+  for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI)
     switch (getArgumentLiveness(*AI)) {
     case Live:
       DEBUG(std::cerr << "    Arg live by use: " << AI->getName() << "\n");
@@ -284,7 +284,7 @@
     // Loop over all of the arguments (because Arg may be passed into the call
     // multiple times) and check to see if any are now alive...
     CallSite::arg_iterator CSAI = CS.arg_begin();
-    for (Function::aiterator AI = Callee->abegin(), E = Callee->aend();
+    for (Function::arg_iterator AI = Callee->arg_begin(), E = Callee->arg_end();
          AI != E; ++AI, ++CSAI)
       // If this is the argument we are looking for, check to see if it's alive
       if (*CSAI == Arg && LiveArguments.count(AI))
@@ -309,7 +309,7 @@
   // passed in to provide a value for this argument live as necessary.
   //
   Function *Fn = Arg->getParent();
-  unsigned ArgNo = std::distance(Fn->abegin(), Function::aiterator(Arg));
+  unsigned ArgNo = std::distance(Fn->arg_begin(), Function::arg_iterator(Arg));
 
   std::multimap<Function*, CallSite>::iterator I = CallSites.lower_bound(Fn);
   for (; I != CallSites.end() && I->first == Fn; ++I) {
@@ -373,7 +373,7 @@
   const FunctionType *FTy = F->getFunctionType();
   std::vector<const Type*> Params;
 
-  for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     if (!DeadArguments.count(I))
       Params.push_back(I->getType());
 
@@ -410,7 +410,7 @@
 
     // Loop over the operands, deleting dead ones...
     CallSite::arg_iterator AI = CS.arg_begin();
-    for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI)
+    for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I, ++AI)
       if (!DeadArguments.count(I))      // Remove operands for dead arguments
         Args.push_back(*AI);
 
@@ -455,7 +455,7 @@
   // the new arguments, also transfering over the names as well.  While we're at
   // it, remove the dead arguments from the DeadArguments list.
   //
-  for (Function::aiterator I = F->abegin(), E = F->aend(), I2 = NF->abegin();
+  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), I2 = NF->arg_begin();
        I != E; ++I)
     if (!DeadArguments.count(I)) {
       // If this is a live argument, move the name and users over to the new
@@ -519,7 +519,7 @@
       // live, then the return value of the called instruction is now live.
       //
       CallSite::arg_iterator AI = CS.arg_begin();  // ActualIterator
-      for (Function::aiterator FI = Callee->abegin(), E = Callee->aend();
+      for (Function::arg_iterator FI = Callee->arg_begin(), E = Callee->arg_end();
            FI != E; ++AI, ++FI) {
         // If this argument is another call...
         CallSite ArgCS = CallSite::get(*AI);
diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp
index 1b92fd1..482964e 100644
--- a/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/lib/Transforms/IPO/ExtractFunction.cpp
@@ -52,7 +52,7 @@
       Named->setLinkage(GlobalValue::ExternalLinkage);
 
       // Mark all global variables internal
-      for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+      for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
         if (!I->isExternal()) {
           I->setInitializer(0);  // Make all variables external
           I->setLinkage(GlobalValue::ExternalLinkage);
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index 090755b..dba44a0 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -311,7 +311,7 @@
       Globals[F->getName()].push_back(F);
   }
 
-  for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) {
+  for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ) {
     GlobalVariable *GV = I++;
     if (GV->use_empty() && GV->isExternal()) {
       M.getGlobalList().erase(GV);
@@ -343,7 +343,7 @@
       ++I;
     }
 
-  for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; )
+  for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; )
     if (I->isExternal() && I->use_empty()) {
       GlobalVariable *GV = I;
       ++I;
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index cdf994a..b7fa5dc 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -60,7 +60,7 @@
       GlobalIsNeeded(I);
   }
 
-  for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
+  for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) {
     Changed |= RemoveUnusedGlobalValue(*I);
     // Externally visible & appending globals are needed, if they have an
     // initializer.
@@ -76,7 +76,7 @@
 
   // The first pass is to drop initializers of global variables which are dead.
   std::vector<GlobalVariable*> DeadGlobalVars;   // Keep track of dead globals
-  for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+  for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
     if (!AliveGlobals.count(I)) {
       DeadGlobalVars.push_back(I);         // Keep track of dead globals
       I->setInitializer(0);
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 754adc3..7b6f649 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -51,7 +51,7 @@
     bool runOnModule(Module &M);
 
   private:
-    bool ProcessInternalGlobal(GlobalVariable *GV, Module::giterator &GVI);
+    bool ProcessInternalGlobal(GlobalVariable *GV, Module::global_iterator &GVI);
   };
 
   RegisterOpt<GlobalOpt> X("globalopt", "Global Variable Optimizer");
@@ -792,7 +792,7 @@
 // OptimizeOnceStoredGlobal - Try to optimize globals based on the knowledge
 // that only one value (besides its initializer) is ever stored to the global.
 static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal,
-                                     Module::giterator &GVI, TargetData &TD) {
+                                     Module::global_iterator &GVI, TargetData &TD) {
   if (CastInst *CI = dyn_cast<CastInst>(StoredOnceVal))
     StoredOnceVal = CI->getOperand(0);
   else if (GetElementPtrInst *GEPI =dyn_cast<GetElementPtrInst>(StoredOnceVal)){
@@ -915,7 +915,7 @@
 /// ProcessInternalGlobal - Analyze the specified global variable and optimize
 /// it if possible.  If we make a change, return true.
 bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
-                                      Module::giterator &GVI) {
+                                      Module::global_iterator &GVI) {
   std::set<PHINode*> PHIUsers;
   GlobalStatus GS;
   PHIUsers.clear();
@@ -1063,7 +1063,7 @@
   LocalChange = true;
   while (LocalChange) {
     LocalChange = false;
-    for (Module::giterator GVI = M.gbegin(), E = M.gend(); GVI != E;) {
+    for (Module::global_iterator GVI = M.global_begin(), E = M.global_end(); GVI != E;) {
       GlobalVariable *GV = GVI++;
       if (!GV->isConstant() && GV->hasInternalLinkage() &&
           GV->hasInitializer())
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index 65d5077..16839ed 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -69,10 +69,10 @@
 /// constant in for an argument, propagate that constant in as the argument.
 ///
 bool IPCP::PropagateConstantsIntoArguments(Function &F) {
-  if (F.aempty() || F.use_empty()) return false;  // No arguments?  Early exit.
+  if (F.arg_empty() || F.use_empty()) return false;  // No arguments?  Early exit.
 
   std::vector<std::pair<Constant*, bool> > ArgumentConstants;
-  ArgumentConstants.resize(F.asize());
+  ArgumentConstants.resize(F.arg_size());
 
   unsigned NumNonconstant = 0;
 
@@ -87,7 +87,7 @@
       
       // Check out all of the potentially constant arguments
       CallSite::arg_iterator AI = CS.arg_begin();
-      Function::aiterator Arg = F.abegin();
+      Function::arg_iterator Arg = F.arg_begin();
       for (unsigned i = 0, e = ArgumentConstants.size(); i != e;
            ++i, ++AI, ++Arg) {
         if (*AI == &F) return false;  // Passes the function into itself
@@ -115,7 +115,7 @@
 
   // If we got to this point, there is a constant argument!
   assert(NumNonconstant != ArgumentConstants.size());
-  Function::aiterator AI = F.abegin();
+  Function::arg_iterator AI = F.arg_begin();
   bool MadeChange = false;
   for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI)
     // Do we have a constant argument!?
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 5916f10..4355c6c 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -167,7 +167,7 @@
 
   // Check out all of the arguments to the function, figuring out how much
   // code can be eliminated if one of the arguments is a constant.
-  for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     ArgumentWeights.push_back(ArgInfo(CountCodeReductionForConstant(I),
                                       CountCodeReductionForAlloca(I)));
 }
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index 5e436aa..5a254fa 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -93,7 +93,7 @@
         }
 
       // Mark all global variables with initializers as internal as well...
-      for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+      for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
         if (!I->isExternal() && !I->hasInternalLinkage() &&
             !ExternalNames.count(I->getName())) {
           // Special case handling of the global ctor and dtor list.  When we
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index 03ea55b..80fe394 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -75,7 +75,7 @@
   // If we're not just stripping debug info, strip all symbols from the
   // functions and the names from any internal globals.
   if (!OnlyDebugInfo) {
-    for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
       if (I->hasInternalLinkage())
         I->setName("");     // Internal symbols can't participate in linkage
 
diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
index 1c0c4ad..5ce0142 100644
--- a/lib/Transforms/Instrumentation/ProfilingUtils.cpp
+++ b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
@@ -55,11 +55,11 @@
   Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos);
 
   // If argc or argv are not available in main, just pass null values in.
-  Function::aiterator AI;
-  switch (MainFn->asize()) {
+  Function::arg_iterator AI;
+  switch (MainFn->arg_size()) {
   default:
   case 2:
-    AI = MainFn->abegin(); ++AI;
+    AI = MainFn->arg_begin(); ++AI;
     if (AI->getType() != ArgVTy) {
       InitCall->setOperand(2, new CastInst(AI, ArgVTy, "argv.cast", InitCall));
     } else {
@@ -67,7 +67,7 @@
     }
 
   case 1:
-    AI = MainFn->abegin();
+    AI = MainFn->arg_begin();
     // If the program looked at argc, have it look at the return value of the
     // init call instead.
     if (AI->getType() != Type::IntTy) {
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index f645f1b..5be8637 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -367,7 +367,7 @@
 
   // Now print all the incoming arguments
   unsigned ArgNo = 0;
-  for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I, ++ArgNo){
+  for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++ArgNo){
     InsertVerbosePrintInst(I, &BB, InsertPos,
                            "  Arg #" + utostr(ArgNo) + ": ", Printf,
                            HashPtrToSeqNum);
diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp
index 6f11506..da8c500 100644
--- a/lib/Transforms/Scalar/CorrelatedExprs.cpp
+++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp
@@ -757,7 +757,7 @@
   unsigned Rank = 1;  // Skip rank zero.
 
   // Number the arguments...
-  for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I)
+  for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I)
     RankMap[I] = Rank++;
 
   // Number the instructions in reverse post order...
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index 533a9e8..dbabe26 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -73,7 +73,7 @@
   // Check for value numbers of arguments.  If the value numbering
   // implementation can prove that an incoming argument is a constant or global
   // value address, substitute it, making the argument dead.
-  for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI)
+  for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI)
     if (!AI->use_empty()) {
       VN.getEqualNumberNodes(AI, EqualValues);
       if (!EqualValues.empty()) {
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index c74cf51..1972b9d 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -66,7 +66,7 @@
   unsigned i = 2;
 
   // Assign distinct ranks to function arguments
-  for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I)
+  for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I)
     ValueRankMap[I] = ++i;
 
   ReversePostOrderTraversal<Function*> RPOT(&F);
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index c769b54..cc05412 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -865,7 +865,7 @@
       MarkBlockExecutable(F->begin());
 
     CallSite::arg_iterator CAI = CS.arg_begin();
-    for (Function::aiterator AI = F->abegin(), E = F->aend();
+    for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
          AI != E; ++AI, ++CAI) {
       LatticeVal &IV = ValueState[AI];
       if (!IV.isOverdefined())
@@ -1044,7 +1044,7 @@
 
   // Mark all arguments to the function as being overdefined.
   hash_map<Value*, LatticeVal> &Values = Solver.getValueMapping();
-  for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI)
+  for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI)
     Values[AI].markOverdefined();
 
   // Solve for constants.
@@ -1173,7 +1173,7 @@
     if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
       if (!F->isExternal())
         Solver.MarkBlockExecutable(F->begin());
-      for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI)
+      for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI)
         Values[AI].markOverdefined();
     } else {
       Solver.AddTrackedFunction(F);
@@ -1182,7 +1182,7 @@
   // Loop over global variables.  We inform the solver about any internal global
   // variables that do not have their 'addresses taken'.  If they don't have
   // their addresses taken, we can propagate constants through them.
-  for (Module::giterator G = M.gbegin(), E = M.gend(); G != E; ++G)
+  for (Module::global_iterator G = M.global_begin(), E = M.global_end(); G != E; ++G)
     if (!G->isConstant() && G->hasInternalLinkage() && !AddressIsTaken(G))
       Solver.TrackValueOfGlobalVariable(G);
 
@@ -1204,7 +1204,7 @@
   //
   std::set<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks();
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
-    for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI)
+    for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI)
       if (!AI->use_empty()) {
         LatticeVal &IV = Values[AI];
         if (IV.isConstant() || IV.isUndefined()) {
diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp
index 758628c..bf098eb 100644
--- a/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -161,7 +161,7 @@
     // Figure out which argument number this is...
     unsigned ArgNo = 0;
     Function *F = CI->getParent()->getParent();
-    for (Function::aiterator AI = F->abegin(); &*AI != Arg; ++AI)
+    for (Function::arg_iterator AI = F->arg_begin(); &*AI != Arg; ++AI)
       ++ArgNo;
     
     // If we are passing this argument into call as the corresponding
@@ -298,7 +298,7 @@
     // For now, we initialize each PHI to only have the real arguments
     // which are passed in.
     Instruction *InsertPos = OldEntry->begin();
-    for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) {
+    for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) {
       PHINode *PN = new PHINode(I->getType(), I->getName()+".tr", InsertPos);
       I->replaceAllUsesWith(PN); // Everyone use the PHI node now!
       PN->addIncoming(I, NewEntry);
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 9bd8bf1..6440851 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -49,7 +49,7 @@
   assert(NameSuffix && "NameSuffix cannot be null!");
   
 #ifndef NDEBUG
-  for (Function::const_aiterator I = OldFunc->abegin(), E = OldFunc->aend();
+  for (Function::const_arg_iterator I = OldFunc->arg_begin(), E = OldFunc->arg_end();
        I != E; ++I)
     assert(ValueMap.count(I) && "No mapping from source argument specified!");
 #endif
@@ -95,7 +95,7 @@
   // The user might be deleting arguments to the function by specifying them in
   // the ValueMap.  If so, we need to not add the arguments to the arg ty vector
   //
-  for (Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     if (ValueMap.count(I) == 0)  // Haven't mapped the argument to anything yet?
       ArgTypes.push_back(I->getType());
 
@@ -107,8 +107,8 @@
   Function *NewF = new Function(FTy, F->getLinkage(), F->getName());
   
   // Loop over the arguments, copying the names of the mapped arguments over...
-  Function::aiterator DestI = NewF->abegin();
-  for (Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  Function::arg_iterator DestI = NewF->arg_begin();
+  for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     if (ValueMap.count(I) == 0) {   // Is this argument preserved?
       DestI->setName(I->getName()); // Copy the name over...
       ValueMap[I] = DestI++;        // Add mapping to ValueMap
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index d98848a..66e005e 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -47,7 +47,7 @@
   // new module.  Here we add them to the ValueMap and to the new Module.  We
   // don't worry about attributes or initializers, they will come later.
   //
-  for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
+  for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I)
     ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), false,
                                      GlobalValue::ExternalLinkage, 0,
                                      I->getName(), New);
@@ -61,7 +61,7 @@
   // have been created, loop through and copy the global variable referrers
   // over...  We also set the attributes on the global now.
   //
-  for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
+  for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) {
     GlobalVariable *GV = cast<GlobalVariable>(ValueMap[I]);
     if (I->hasInitializer())
       GV->setInitializer(cast<Constant>(MapValue(I->getInitializer(),
@@ -74,8 +74,8 @@
   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) {
     Function *F = cast<Function>(ValueMap[I]);
     if (!I->isExternal()) {
-      Function::aiterator DestI = F->abegin();
-      for (Function::const_aiterator J = I->abegin(); J != I->aend(); ++J) {
+      Function::arg_iterator DestI = F->arg_begin();
+      for (Function::const_arg_iterator J = I->arg_begin(); J != I->arg_end(); ++J) {
         DestI->setName(J->getName());
         ValueMap[J] = DestI++;
       }
diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp
index 5a04001..cf9cafb0 100644
--- a/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/lib/Transforms/Utils/CodeExtractor.cpp
@@ -295,7 +295,7 @@
   newFunction->getBasicBlockList().push_back(newRootNode);
 
   // Create an iterator to name all of the arguments we inserted.
-  Function::aiterator AI = newFunction->abegin();
+  Function::arg_iterator AI = newFunction->arg_begin();
 
   // Rewrite all users of the inputs in the extracted region to use the
   // arguments (or appropriate addressing into struct) instead.
@@ -322,7 +322,7 @@
 
   // Set names for input and output arguments.
   if (!AggregateArgs) {
-    AI = newFunction->abegin();
+    AI = newFunction->arg_begin();
     for (unsigned i = 0, e = inputs.size(); i != e; ++i, ++AI)
       AI->setName(inputs[i]->getName());
     for (unsigned i = 0, e = outputs.size(); i != e; ++i, ++AI)
@@ -406,7 +406,7 @@
                                 NumExitBlocks > 1 ? "targetBlock" : "");
   codeReplacer->getInstList().push_back(call);
 
-  Function::aiterator OutputArgBegin = newFunction->abegin();
+  Function::arg_iterator OutputArgBegin = newFunction->arg_begin();
   unsigned FirstOut = inputs.size();
   if (!AggregateArgs)
     std::advance(OutputArgBegin, inputs.size());
@@ -483,7 +483,7 @@
                              OldTarget);
 
           // Restore values just before we exit
-          Function::aiterator OAI = OutputArgBegin;
+          Function::arg_iterator OAI = OutputArgBegin;
           for (unsigned out = 0, e = outputs.size(); out != e; ++out) {
             // For an invoke, the normal destination is the only one that is
             // dominated by the result of the invocation
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 1384022..6bfdda2 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -60,13 +60,13 @@
   { // Scope to destroy ValueMap after cloning.
     // Calculate the vector of arguments to pass into the function cloner...
     std::map<const Value*, Value*> ValueMap;
-    assert(std::distance(CalledFunc->abegin(), CalledFunc->aend()) == 
+    assert(std::distance(CalledFunc->arg_begin(), CalledFunc->arg_end()) == 
            std::distance(CS.arg_begin(), CS.arg_end()) &&
            "No varargs calls can be inlined!");
     
     CallSite::arg_iterator AI = CS.arg_begin();
-    for (Function::const_aiterator I = CalledFunc->abegin(),
-           E = CalledFunc->aend(); I != E; ++I, ++AI)
+    for (Function::const_arg_iterator I = CalledFunc->arg_begin(),
+           E = CalledFunc->arg_end(); I != E; ++I, ++AI)
       ValueMap[I] = *AI;
     
     // Clone the entire body of the callee into the caller.