[llvm-commits] [poolalloc] r137604 - in /poolalloc/trunk/lib: AssistDS/TypeChecks.cpp PoolAllocate/AccessTrace.cpp PoolAllocate/PAMultipleGlobalPool.cpp PoolAllocate/PASimple.cpp PoolAllocate/PointerCompress.cpp PoolAllocate/PoolAllocate.cpp PoolAllocate/PoolOptimize.cpp PoolAllocate/TransformFunctionBody.cpp

Will Dietz wdietz2 at illinois.edu
Sun Aug 14 21:58:25 PDT 2011


Author: wdietz2
Date: Sun Aug 14 23:58:25 2011
New Revision: 137604

URL: http://llvm.org/viewvc/llvm-project?rev=137604&view=rev
Log:
No need to explicitly construct ArrayRef's, seems to work fine without doing so.

(sed -i 's/ArrayRef<[^)]*>(\([^)]*\))/\1/')

Modified:
    poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
    poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp
    poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
    poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
    poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
    poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
    poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp
    poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Sun Aug 14 23:58:25 2011
@@ -608,7 +608,7 @@
                                           CA,
                                           "");
   GV->setInitializer(CA);
-  Constant *C = ConstantExpr::getGetElementPtr(GV,ArrayRef<Constant*>(Indices));
+  Constant *C = ConstantExpr::getGetElementPtr(GV,Indices);
   Values[0] = C;
 
   // For each used type, create a new entry. 
@@ -629,7 +629,7 @@
                                             CA,
                                             "");
     GV->setInitializer(CA);
-    Constant *C = ConstantExpr::getGetElementPtr(GV, ArrayRef<Constant*>(Indices));
+    Constant *C = ConstantExpr::getGetElementPtr(GV, Indices);
     Values[TI->second]= C;
   }
 

Modified: poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp Sun Aug 14 23:58:25 2011
@@ -97,7 +97,7 @@
 
   // Insert the trace call.
   Value *Opts[2] = {Ptr, PD};
-  CallInst::Create (PoolAccessTraceFn, ArrayRef<Value*>(Opts), "", I);
+  CallInst::Create (PoolAccessTraceFn, Opts, "", I);
 }
 
 bool PoolAccessTrace::runOnModule(Module &M) {

Modified: poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp Sun Aug 14 23:58:25 2011
@@ -216,7 +216,7 @@
           std::string Name = CI->getName(); CI->setName("");
           Value* Opts[3] = {Pool, OldPtr, Size};
           Instruction *V = CallInst::Create (PoolRealloc,
-                                         ArrayRef<Value*>(Opts),
+                                         Opts,
                                          Name,
                                          InsertPt);
           Value *Casted = castTo(V, CI->getType(), V->getName(), InsertPt);
@@ -260,7 +260,7 @@
           std::string Name = CI->getName(); CI->setName("");
           Value* Opts[3] = {Pool, NumElements, Size};
           Instruction *V = CallInst::Create (PoolCalloc,
-                                             ArrayRef<Value*>(Opts),
+                                             Opts,
                                              Name,
                                              InsertPt);
 
@@ -297,7 +297,7 @@
           std::string Name = CI->getName(); CI->setName("");
           Value* Opts[2] = {Pool, OldPtr};
           Instruction *V = CallInst::Create (PoolStrdup,
-                                         ArrayRef<Value*>(Opts),
+                                         Opts,
                                          Name,
                                          InsertPt);
           Value *Casted = castTo(V, CI->getType(), V->getName(), InsertPt);
@@ -411,7 +411,7 @@
     Value *AlignV = ConstantInt::get(Int32Type, Align);
     Value* Opts[3] = {GV, ElSize, AlignV};
     
-    CallInst::Create(PoolInit, ArrayRef<Value*>(Opts), "", InsertAtEnd);
+    CallInst::Create(PoolInit, Opts, "", InsertAtEnd);
     PoolMap[Node] = GV;
   }
 }

Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Sun Aug 14 23:58:25 2011
@@ -292,7 +292,7 @@
           //
           Value* Opts[3] = {TheGlobalPool, Size};
           Instruction *V = CallInst::Create (PoolAlloc,
-                                             ArrayRef<Value*>(Opts),
+                                             Opts,
                                              Name,
                                              InsertPt);
 
@@ -343,7 +343,7 @@
           //
           Value* Opts[3] = {TheGlobalPool, Align, Size};
           Instruction *V = CallInst::Create (PoolMemAlign,
-                                             ArrayRef<Value*>(Opts),
+                                             Opts,
                                              Name,
                                              InsertPt);
 
@@ -389,7 +389,7 @@
           std::string Name = CI->getName(); CI->setName("");
           Value* Opts[3] = {TheGlobalPool, OldPtr, Size};
           Instruction *V = CallInst::Create (PoolRealloc,
-                                         ArrayRef<Value*>(Opts),
+                                         Opts,
                                          Name,
                                          InsertPt);
           //
@@ -434,7 +434,7 @@
           std::string Name = CI->getName(); CI->setName("");
           Value* Opts[3] = {TheGlobalPool, NumElements, Size};
           Instruction *V = CallInst::Create (PoolCalloc,
-                                             ArrayRef<Value*>(Opts),
+                                             Opts,
                                              Name,
                                              InsertPt);
 
@@ -472,7 +472,7 @@
           std::string Name = CI->getName(); CI->setName("");
           Value* Opts[2] = {TheGlobalPool, OldPtr};
           Instruction *V = CallInst::Create (PoolStrdup,
-                                         ArrayRef<Value*>(Opts),
+                                         Opts,
                                          Name,
                                          InsertPt);
 
@@ -492,7 +492,7 @@
           Value * FreedNode = castTo (CI->getOperand(1), VoidPtrTy, "cast", ii);
           toDelete.push_back(ii);
           Value* args[] = {TheGlobalPool, FreedNode};
-          CallInst::Create(PoolFree, ArrayRef<Value*>(args), "", ii);
+          CallInst::Create(PoolFree, args, "", ii);
         }
 
         //
@@ -561,7 +561,7 @@
   Value *ElSize = ConstantInt::get(Int32Type, RecSize);
   Value *AlignV = ConstantInt::get(Int32Type, Align);
   Value* Opts[3] = {GV, ElSize, AlignV};
-  CallInst::Create(PoolInit, ArrayRef<Value*>(Opts), "", BB);
+  CallInst::Create(PoolInit, Opts, "", BB);
 
   ReturnInst::Create(M.getContext(), BB);
   return GV;

Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Sun Aug 14 23:58:25 2011
@@ -297,7 +297,7 @@
     // Get the pool base pointer.
     Constant *Zero = ConstantInt::get(Int32Type, 0);
     Value *Opts[2] = {Zero, Zero};
-    Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), ArrayRef<Value*>(Opts),
+    Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), Opts,
                                               "poolbaseptrptr", &I);
     return new LoadInst(BasePtrPtr, "poolbaseptr", &I);
   } else {
@@ -309,7 +309,7 @@
       while (isa<AllocaInst>(IP)) ++IP;
       Constant *Zero = ConstantInt::get(Int32Type, 0);
       Value *Opts[2] = {Zero, Zero};
-      Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), ArrayRef<Value*>(Opts),
+      Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), Opts,
                                                 "poolbaseptrptr", IP);
       PoolBase = new LoadInst(BasePtrPtr, "poolbaseptr", IP);
     }
@@ -923,7 +923,7 @@
     }
 
   Value *Opts[2] = {CI.getOperand(1), Size};
-  Value *NC = CallInst::Create(PtrComp.PoolAllocPC, ArrayRef<Value*>(Opts), CI.getName(), &CI);
+  Value *NC = CallInst::Create(PtrComp.PoolAllocPC, Opts, CI.getName(), &CI);
   setTransformedValue(CI, NC);
 }
 

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Sun Aug 14 23:58:25 2011
@@ -142,7 +142,7 @@
   std::vector<Constant *> CtorInits;
   CtorInits.push_back (ConstantInt::get (Int32Type, 65535));
   CtorInits.push_back (InitFunc);
-  Constant * RuntimeCtorInit = ConstantStruct::getAnon(Context, ArrayRef<Constant*>(CtorInits));
+  Constant * RuntimeCtorInit = ConstantStruct::getAnon(Context, CtorInits);
 
   //
   // Get the current set of static global constructors and add the new ctor
@@ -1093,7 +1093,7 @@
   Value *ElSize = ConstantInt::get(Int32Type, RecSize);
   Value *AlignV = ConstantInt::get(Int32Type, Align);
   Value* Opts[3] = {GV, ElSize, AlignV};
-  CallInst::Create(PoolInit, ArrayRef<Value*>(Opts), "", InsertPt);
+  CallInst::Create(PoolInit, Opts, "", InsertPt);
   ++NumPools;
   return GV;
 }
@@ -1502,7 +1502,7 @@
 
   for (unsigned i = 0, e = PoolInitPoints.size(); i != e; ++i) {
     Value* Opts[3] = {PD, ElSize, Align};
-    CallInst::Create(PoolInit, ArrayRef<Value*>(Opts),  "", PoolInitPoints[i]);
+    CallInst::Create(PoolInit, Opts,  "", PoolInitPoints[i]);
     DEBUG(errs() << PoolInitPoints[i]->getParent()->getNameStr() << " ");
   }
 

Modified: poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp Sun Aug 14 23:58:25 2011
@@ -135,7 +135,7 @@
     // poolrealloc(PD, null, X) -> poolalloc(PD, X)
     if (isa<ConstantPointerNull>(CI->getOperand(2))) {
       Value* Opts[2] = {CI->getOperand(1), CI->getOperand(3)};
-      Value *New = CallInst::Create(PoolAlloc, ArrayRef<Value*>(Opts),
+      Value *New = CallInst::Create(PoolAlloc, Opts,
                                 CI->getName(), CI);
       CI->replaceAllUsesWith(New);
       CI->eraseFromParent();
@@ -143,7 +143,7 @@
                cast<Constant>(CI->getOperand(3))->isNullValue()) {
       // poolrealloc(PD, X, 0) -> poolfree(PD, X)
       Value* Opts[2] = {CI->getOperand(1), CI->getOperand(2)};
-      CallInst::Create(PoolFree, ArrayRef<Value*>(Opts), "", CI);
+      CallInst::Create(PoolFree, Opts, "", CI);
       PointerType * PT = dyn_cast<PointerType>(CI->getType());
       assert (PT && "poolrealloc call does not return a pointer!\n");
       CI->replaceAllUsesWith(ConstantPointerNull::get(PT));
@@ -151,7 +151,7 @@
     } else if (isa<ConstantPointerNull>(CI->getOperand(1))) {
       // poolrealloc(null, X, Y) -> realloc(X, Y)
       Value* Opts[2] = {CI->getOperand(2), CI->getOperand(3)};
-      Value *New = CallInst::Create(Realloc, ArrayRef<Value*>(Opts),
+      Value *New = CallInst::Create(Realloc, Opts,
                                 CI->getName(), CI);
       CI->replaceAllUsesWith(New);
       CI->eraseFromParent();
@@ -182,7 +182,7 @@
     // poolmemalign(null, X, Y) -> memalign(X, Y)
     if (isa<ConstantPointerNull>(CI->getOperand(1))) {
       Value* Opts[2] = {CI->getOperand(2), CI->getOperand(3)};
-      Value *New = CallInst::Create(MemAlign, ArrayRef<Value*>(Opts), CI->getName(), CI);
+      Value *New = CallInst::Create(MemAlign, Opts, CI->getName(), CI);
       CI->replaceAllUsesWith(New);
       CI->eraseFromParent();
     }

Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=137604&r1=137603&r2=137604&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Sun Aug 14 23:58:25 2011
@@ -282,7 +282,7 @@
 
   // Create call to poolalloc, and record the use of the pool
   Value* Opts[2] = {PH, Size};
-  Instruction *V = CallInst::Create(PAInfo.PoolAlloc, ArrayRef<Value*>(Opts), Name, I);
+  Instruction *V = CallInst::Create(PAInfo.PoolAlloc, Opts, Name, I);
   AddPoolUse(*V, PH, PoolUses);
 
   // Cast to the appropriate type if necessary
@@ -377,7 +377,7 @@
   // Insert a call to poolfree(), and mark that memory was deallocated from the pool.
   //
   Value* Opts[2] = {PH, Casted};
-  CallInst *FreeI = CallInst::Create(PAInfo.PoolFree, ArrayRef<Value*>(Opts), "", Where);
+  CallInst *FreeI = CallInst::Create(PAInfo.PoolFree, Opts, "", Where);
   AddPoolUse(*FreeI, PH, PoolFrees);
   return FreeI;
 }
@@ -494,7 +494,7 @@
   // Create call to poolcalloc, and record the use of the pool
   //
   Value* Opts[3] = {PH, V1, V2};
-  Instruction *V = CallInst::Create(PAInfo.PoolCalloc, ArrayRef<Value*>(Opts), Name, I);
+  Instruction *V = CallInst::Create(PAInfo.PoolCalloc, Opts, Name, I);
   AddPoolUse(*V, PH, PoolUses);
 
   // Cast to the appropriate type if necessary
@@ -548,7 +548,7 @@
 
   std::string Name = I->getName(); I->setName("");
   Value* Opts[3] = {PH, OldPtr, Size};
-  Instruction *V = CallInst::Create(PAInfo.PoolRealloc, ArrayRef<Value*>(Opts), Name, I);
+  Instruction *V = CallInst::Create(PAInfo.PoolRealloc, Opts, Name, I);
   Instruction *Casted = V;
   if (V->getType() != I->getType())
     Casted = CastInst::CreatePointerCast(V, I->getType(), V->getName(), I);
@@ -622,7 +622,7 @@
 
   std::string Name = I->getName(); I->setName("");
   Value* Opts[3] = {PH, Align, Size};
-  Instruction *V = CallInst::Create(PAInfo.PoolMemAlign, ArrayRef<Value*>(Opts), Name, I);
+  Instruction *V = CallInst::Create(PAInfo.PoolMemAlign, Opts, Name, I);
 
   Instruction *Casted = V;
   if (V->getType() != I->getType())
@@ -681,7 +681,7 @@
 
   std::string Name = I->getName(); I->setName("");
   Value* Opts[3] = {PH, OldPtr, 0};
-  Instruction *V = CallInst::Create(PAInfo.PoolStrdup, ArrayRef<Value*>(Opts), Name, I);
+  Instruction *V = CallInst::Create(PAInfo.PoolStrdup, Opts, Name, I);
   Instruction *Casted = V;
   if (V->getType() != I->getType())
     Casted = CastInst::CreatePointerCast(V, I->getType(), V->getName(), I);





More information about the llvm-commits mailing list