[llvm-commits] [llvm] r75863 - in /llvm/trunk: include/llvm/ include/llvm/Support/ include/llvm/Transforms/Utils/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/Transforms/IPO/ lib/Transforms/Instrumentation/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/

Owen Anderson resistor at mac.com
Wed Jul 15 16:53:29 PDT 2009


Author: resistor
Date: Wed Jul 15 18:53:25 2009
New Revision: 75863

URL: http://llvm.org/viewvc/llvm-project?rev=75863&view=rev
Log:
Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.

Modified:
    llvm/trunk/include/llvm/Instructions.h
    llvm/trunk/include/llvm/Support/IRBuilder.h
    llvm/trunk/include/llvm/Transforms/Utils/Local.h
    llvm/trunk/lib/AsmParser/LLParser.cpp
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp
    llvm/trunk/lib/CodeGen/StackProtector.cpp
    llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
    llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
    llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp
    llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp
    llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp
    llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
    llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
    llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp
    llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp
    llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
    llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp
    llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
    llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp
    llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
    llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Wed Jul 15 18:53:25 2009
@@ -40,12 +40,10 @@
 ///
 class AllocationInst : public UnaryInstruction {
 protected:
-  LLVMContext &Context;
-
-  AllocationInst(LLVMContext &Context, const Type *Ty, Value *ArraySize, 
+  AllocationInst(const Type *Ty, Value *ArraySize, 
                  unsigned iTy, unsigned Align, const std::string &Name = "", 
                  Instruction *InsertBefore = 0);
-  AllocationInst(LLVMContext &Context, const Type *Ty, Value *ArraySize,
+  AllocationInst(const Type *Ty, Value *ArraySize,
                  unsigned iTy, unsigned Align, const std::string &Name,
                  BasicBlock *InsertAtEnd);
 public:
@@ -103,32 +101,31 @@
 class MallocInst : public AllocationInst {
   MallocInst(const MallocInst &MI);
 public:
-  explicit MallocInst(LLVMContext &Context, 
-                      const Type *Ty, Value *ArraySize = 0,
+  explicit MallocInst(const Type *Ty, Value *ArraySize = 0,
                       const std::string &NameStr = "",
                       Instruction *InsertBefore = 0)
-    : AllocationInst(Context, Ty, ArraySize, Malloc,
+    : AllocationInst(Ty, ArraySize, Malloc,
                      0, NameStr, InsertBefore) {}
-  MallocInst(LLVMContext &Context, const Type *Ty, Value *ArraySize,
+  MallocInst(const Type *Ty, Value *ArraySize,
              const std::string &NameStr, BasicBlock *InsertAtEnd)
-    : AllocationInst(Context, Ty, ArraySize, Malloc, 0, NameStr, InsertAtEnd) {}
+    : AllocationInst(Ty, ArraySize, Malloc, 0, NameStr, InsertAtEnd) {}
 
-  MallocInst(LLVMContext &Context, const Type *Ty, const std::string &NameStr,
+  MallocInst(const Type *Ty, const std::string &NameStr,
              Instruction *InsertBefore = 0)
-    : AllocationInst(Context, Ty, 0, Malloc, 0, NameStr, InsertBefore) {}
-  MallocInst(LLVMContext &Context, const Type *Ty, const std::string &NameStr,
+    : AllocationInst(Ty, 0, Malloc, 0, NameStr, InsertBefore) {}
+  MallocInst(const Type *Ty, const std::string &NameStr,
              BasicBlock *InsertAtEnd)
-    : AllocationInst(Context, Ty, 0, Malloc, 0, NameStr, InsertAtEnd) {}
+    : AllocationInst(Ty, 0, Malloc, 0, NameStr, InsertAtEnd) {}
 
-  MallocInst(LLVMContext &Context, const Type *Ty, Value *ArraySize,
+  MallocInst(const Type *Ty, Value *ArraySize,
              unsigned Align, const std::string &NameStr,
              BasicBlock *InsertAtEnd)
-    : AllocationInst(Context, Ty, ArraySize, Malloc,
+    : AllocationInst(Ty, ArraySize, Malloc,
                      Align, NameStr, InsertAtEnd) {}
-  MallocInst(LLVMContext &Context, const Type *Ty, Value *ArraySize,
+  MallocInst(const Type *Ty, Value *ArraySize,
              unsigned Align, const std::string &NameStr = "", 
              Instruction *InsertBefore = 0)
-    : AllocationInst(Context, Ty, ArraySize,
+    : AllocationInst(Ty, ArraySize,
                      Malloc, Align, NameStr, InsertBefore) {}
 
   virtual MallocInst *clone(LLVMContext &Context) const;
@@ -153,33 +150,33 @@
 class AllocaInst : public AllocationInst {
   AllocaInst(const AllocaInst &);
 public:
-  explicit AllocaInst(LLVMContext &Context, const Type *Ty,
+  explicit AllocaInst(const Type *Ty,
                       Value *ArraySize = 0,
                       const std::string &NameStr = "",
                       Instruction *InsertBefore = 0)
-    : AllocationInst(Context, Ty, ArraySize, Alloca,
+    : AllocationInst(Ty, ArraySize, Alloca,
                      0, NameStr, InsertBefore) {}
-  AllocaInst(LLVMContext &Context, const Type *Ty,
+  AllocaInst(const Type *Ty,
              Value *ArraySize, const std::string &NameStr,
              BasicBlock *InsertAtEnd)
-    : AllocationInst(Context, Ty, ArraySize, Alloca, 0, NameStr, InsertAtEnd) {}
+    : AllocationInst(Ty, ArraySize, Alloca, 0, NameStr, InsertAtEnd) {}
 
-  AllocaInst(LLVMContext &Context, const Type *Ty, const std::string &NameStr,
+  AllocaInst(const Type *Ty, const std::string &NameStr,
              Instruction *InsertBefore = 0)
-    : AllocationInst(Context, Ty, 0, Alloca, 0, NameStr, InsertBefore) {}
-  AllocaInst(LLVMContext &Context, const Type *Ty, const std::string &NameStr,
+    : AllocationInst(Ty, 0, Alloca, 0, NameStr, InsertBefore) {}
+  AllocaInst(const Type *Ty, const std::string &NameStr,
              BasicBlock *InsertAtEnd)
-    : AllocationInst(Context, Ty, 0, Alloca, 0, NameStr, InsertAtEnd) {}
+    : AllocationInst(Ty, 0, Alloca, 0, NameStr, InsertAtEnd) {}
 
-  AllocaInst(LLVMContext &Context, const Type *Ty, Value *ArraySize,
+  AllocaInst(const Type *Ty, Value *ArraySize,
              unsigned Align, const std::string &NameStr = "",
              Instruction *InsertBefore = 0)
-    : AllocationInst(Context, Ty, ArraySize, Alloca,
+    : AllocationInst(Ty, ArraySize, Alloca,
                      Align, NameStr, InsertBefore) {}
-  AllocaInst(LLVMContext &Context, const Type *Ty, Value *ArraySize,
+  AllocaInst(const Type *Ty, Value *ArraySize,
              unsigned Align, const std::string &NameStr,
              BasicBlock *InsertAtEnd)
-    : AllocationInst(Context, Ty, ArraySize, Alloca,
+    : AllocationInst(Ty, ArraySize, Alloca,
                      Align, NameStr, InsertAtEnd) {}
 
   virtual AllocaInst *clone(LLVMContext &Context) const;

Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Jul 15 18:53:25 2009
@@ -330,11 +330,11 @@
 
   MallocInst *CreateMalloc(const Type *Ty, Value *ArraySize = 0,
                            const char *Name = "") {
-    return Insert(new MallocInst(Context, Ty, ArraySize), Name);
+    return Insert(new MallocInst(Ty, ArraySize), Name);
   }
   AllocaInst *CreateAlloca(const Type *Ty, Value *ArraySize = 0,
                            const char *Name = "") {
-    return Insert(new AllocaInst(Context, Ty, ArraySize), Name);
+    return Insert(new AllocaInst(Ty, ArraySize), Name);
   }
   FreeInst *CreateFree(Value *Ptr) {
     return Insert(new FreeInst(Ptr));

Modified: llvm/trunk/include/llvm/Transforms/Utils/Local.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Local.h?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Local.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Local.h Wed Jul 15 18:53:25 2009
@@ -108,15 +108,14 @@
 /// invalidating the SSA information for the value.  It returns the pointer to
 /// the alloca inserted to create a stack slot for X.
 ///
-AllocaInst *DemoteRegToStack(LLVMContext &Context, Instruction &X,
+AllocaInst *DemoteRegToStack(Instruction &X,
                              bool VolatileLoads = false,
                              Instruction *AllocaPoint = 0);
 
 /// DemotePHIToStack - This function takes a virtual register computed by a phi
 /// node and replaces it with a slot in the stack frame, allocated via alloca.
 /// The phi node is deleted and it returns the pointer to the alloca inserted. 
-AllocaInst *DemotePHIToStack(LLVMContext &Context, PHINode *P,
-                             Instruction *AllocaPoint = 0);
+AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = 0);
 
 /// OnlyUsedByDbgIntrinsics - Return true if the instruction I is only used
 /// by DbgIntrinsics. If DbgInUses is specified then the vector is filled 

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jul 15 18:53:25 2009
@@ -3182,9 +3182,9 @@
     return Error(SizeLoc, "element count must be i32");
 
   if (Opc == Instruction::Malloc)
-    Inst = new MallocInst(Context, Ty, Size, Alignment);
+    Inst = new MallocInst(Ty, Size, Alignment);
   else
-    Inst = new AllocaInst(Context, Ty, Size, Alignment);
+    Inst = new AllocaInst(Ty, Size, Alignment);
   return false;
 }
 

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Jul 15 18:53:25 2009
@@ -1817,8 +1817,7 @@
       Value *Size = getFnValueByID(Record[1], Type::Int32Ty);
       unsigned Align = Record[2];
       if (!Ty || !Size) return Error("Invalid MALLOC record");
-      I = new MallocInst(Context, Ty->getElementType(), Size,
-                         (1 << Align) >> 1);
+      I = new MallocInst(Ty->getElementType(), Size, (1 << Align) >> 1);
       break;
     }
     case bitc::FUNC_CODE_INST_FREE: { // FREE: [op, opty]
@@ -1838,8 +1837,7 @@
       Value *Size = getFnValueByID(Record[1], Type::Int32Ty);
       unsigned Align = Record[2];
       if (!Ty || !Size) return Error("Invalid ALLOCA record");
-      I = new AllocaInst(Context, Ty->getElementType(), Size,
-                         (1 << Align) >> 1);
+      I = new AllocaInst(Ty->getElementType(), Size, (1 << Align) >> 1);
       break;
     }
     case bitc::FUNC_CODE_INST_LOAD: { // LOAD: [opty, op, align, vol]

Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Wed Jul 15 18:53:25 2009
@@ -354,8 +354,8 @@
 
   // Create the temporary if we didn't already.
   if (!ExceptionValueVar) {
-    ExceptionValueVar = new AllocaInst(*Context, 
-                                       PointerType::getUnqual(Type::Int8Ty),
+    ExceptionValueVar = new AllocaInst(
+                                    Context->getPointerTypeUnqual(Type::Int8Ty),
                                        "eh.value", F->begin()->begin());
     ++NumStackTempsIntroduced;
   }

Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackProtector.cpp Wed Jul 15 18:53:25 2009
@@ -154,7 +154,7 @@
       BasicBlock &Entry = F->getEntryBlock();
       Instruction *InsPt = &Entry.front();
 
-      AI = new AllocaInst(*Context, PtrTy, "StackGuardSlot", InsPt);
+      AI = new AllocaInst(PtrTy, "StackGuardSlot", InsPt);
       LoadInst *LI = new LoadInst(StackGuardVar, "StackGuard", false, InsPt);
 
       Value *Args[] = { LI, AI };

Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Jul 15 18:53:25 2009
@@ -755,7 +755,7 @@
 
       // Just add all the struct element types.
       const Type *AgTy = cast<PointerType>(I->getType())->getElementType();
-      Value *TheAlloca = new AllocaInst(*Context, AgTy, 0, "", InsertPt);
+      Value *TheAlloca = new AllocaInst(AgTy, 0, "", InsertPt);
       const StructType *STy = cast<StructType>(AgTy);
       Value *Idxs[2] = { Context->getConstantInt(Type::Int32Ty, 0), 0 };
 

Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed Jul 15 18:53:25 2009
@@ -828,7 +828,7 @@
     Type *NewTy = Context->getArrayType(MI->getAllocatedType(),
                                  NElements->getZExtValue());
     MallocInst *NewMI =
-      new MallocInst(*Context, NewTy, Context->getNullValue(Type::Int32Ty),
+      new MallocInst(NewTy, Context->getNullValue(Type::Int32Ty),
                      MI->getAlignment(), MI->getName(), MI);
     Value* Indices[2];
     Indices[0] = Indices[1] = Context->getNullValue(Type::Int32Ty);
@@ -1291,7 +1291,7 @@
                          GV->isThreadLocal());
     FieldGlobals.push_back(NGV);
     
-    MallocInst *NMI = new MallocInst(*Context, FieldTy, MI->getArraySize(),
+    MallocInst *NMI = new MallocInst(FieldTy, MI->getArraySize(),
                                      MI->getName() + ".f" + utostr(FieldNo),MI);
     FieldMallocs.push_back(NMI);
     new StoreInst(NMI, NGV, MI);
@@ -1507,7 +1507,7 @@
       // structs.  malloc [100 x struct],1 -> malloc struct, 100
       if (const ArrayType *AT = dyn_cast<ArrayType>(MI->getAllocatedType())) {
         MallocInst *NewMI = 
-          new MallocInst(*Context, AllocSTy, 
+          new MallocInst(AllocSTy, 
                   Context->getConstantInt(Type::Int32Ty, AT->getNumElements()),
                          "", MI);
         NewMI->takeName(MI);
@@ -1703,8 +1703,7 @@
       Instruction* FirstI = GS.AccessingFunction->getEntryBlock().begin();
       const Type* ElemTy = GV->getType()->getElementType();
       // FIXME: Pass Global's alignment when globals have alignment
-      AllocaInst* Alloca = new AllocaInst(*Context, ElemTy, NULL,
-                                          GV->getName(), FirstI);
+      AllocaInst* Alloca = new AllocaInst(ElemTy, NULL, GV->getName(), FirstI);
       if (!isa<UndefValue>(GV->getInitializer()))
         new StoreInst(GV->getInitializer(), Alloca, FirstI);
 

Modified: llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp Wed Jul 15 18:53:25 2009
@@ -73,7 +73,7 @@
       BasicBlock* bb = BasicBlock::Create("entry",FN);
       Instruction* c = CastInst::CreateIntegerCast(
           FN->arg_begin(), Type::Int32Ty, false, "c", bb);
-      Instruction* a = new MallocInst(*Context, Type::Int8Ty, c, "m", bb);
+      Instruction* a = new MallocInst(Type::Int8Ty, c, "m", bb);
       ReturnInst::Create(a, bb);
       ++NumBounce;
       NumBounceSites += F->getNumUses();

Modified: llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp Wed Jul 15 18:53:25 2009
@@ -311,7 +311,7 @@
 
   // Fill in the alloca and call to initialize the SJ map.
   const Type *SBPTy = Context->getPointerTypeUnqual(Type::Int8Ty);
-  AllocaInst* Map = new AllocaInst(*Context, SBPTy, 0, "SJMap", Inst);
+  AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst);
   CallInst::Create(InitSJMap, Map, "", Inst);
   return SJMap[Func] = Map;
 }
@@ -408,7 +408,7 @@
          UI != E; ++UI)
       if (cast<Instruction>(*UI)->getParent() != ABlock ||
           InstrsAfterCall.count(cast<Instruction>(*UI))) {
-        DemoteRegToStack(*Context, *II);
+        DemoteRegToStack(*II);
         break;
       }
   InstrsAfterCall.clear();

Modified: llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp Wed Jul 15 18:53:25 2009
@@ -169,8 +169,7 @@
               CastInst::CreateIntegerCast(Source, Type::Int32Ty, false/*ZExt*/,
                                           "MallocAmtCast", I);
 
-          MallocInst *MI = new MallocInst(*Context, Type::Int8Ty,
-                                          Source, "", I);
+          MallocInst *MI = new MallocInst(Type::Int8Ty, Source, "", I);
           MI->takeName(I);
           I->replaceAllUsesWith(MI);
 

Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Wed Jul 15 18:53:25 2009
@@ -110,8 +110,8 @@
   DOUT << "SretPromotion: sret argument will be promoted\n";
   NumSRET++;
   // [1] Replace use of sret parameter 
-  AllocaInst *TheAlloca = new AllocaInst (*Context, STy, NULL, "mrv", 
-                                          F->getEntryBlock().begin());
+  AllocaInst *TheAlloca = new AllocaInst(STy, NULL, "mrv", 
+                                         F->getEntryBlock().begin());
   Value *NFirstArg = F->arg_begin();
   NFirstArg->replaceAllUsesWith(TheAlloca);
 

Modified: llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp Wed Jul 15 18:53:25 2009
@@ -248,7 +248,7 @@
   //make a local temporary to cache the global
   BasicBlock& bb = F->getEntryBlock();
   BasicBlock::iterator InsertPt = bb.begin();
-  AI = new AllocaInst(*F->getContext(), T, 0, "localcounter", InsertPt);
+  AI = new AllocaInst(T, 0, "localcounter", InsertPt);
   LoadInst* l = new LoadInst(Counter, "counterload", InsertPt);
   new StoreInst(l, AI, InsertPt);
   

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Jul 15 18:53:25 2009
@@ -7891,9 +7891,9 @@
   
   AllocationInst *New;
   if (isa<MallocInst>(AI))
-    New = new MallocInst(*Context, CastElTy, Amt, AI.getAlignment());
+    New = new MallocInst(CastElTy, Amt, AI.getAlignment());
   else
-    New = new AllocaInst(*Context, CastElTy, Amt, AI.getAlignment());
+    New = new AllocaInst(CastElTy, Amt, AI.getAlignment());
   InsertNewInstBefore(New, AI);
   New->takeName(&AI);
   
@@ -11368,12 +11368,10 @@
 
       // Create and insert the replacement instruction...
       if (isa<MallocInst>(AI))
-        New = new MallocInst(*Context, NewTy, 0,
-                             AI.getAlignment(), AI.getName());
+        New = new MallocInst(NewTy, 0, AI.getAlignment(), AI.getName());
       else {
         assert(isa<AllocaInst>(AI) && "Unknown type of allocation inst!");
-        New = new AllocaInst(*Context, NewTy, 0,
-                             AI.getAlignment(), AI.getName());
+        New = new AllocaInst(NewTy, 0, AI.getAlignment(), AI.getName());
       }
 
       InsertNewInstBefore(New, AI);

Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Wed Jul 15 18:53:25 2009
@@ -912,7 +912,7 @@
     
     // We found a use of I outside of BB.  Create a new stack slot to
     // break this inter-block usage pattern.
-    DemoteRegToStack(*Context, *I);
+    DemoteRegToStack(*I);
   }
  
   // We are going to have to map operands from the original BB block to the new

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Wed Jul 15 18:53:25 2009
@@ -508,7 +508,7 @@
     AllocaInst *AI = 0;
 
     if (I.getType() != Type::VoidTy) {
-      AI = new AllocaInst(*Context, I.getType(), 0, I.getName(),
+      AI = new AllocaInst(I.getType(), 0, I.getName(),
                           I.getParent()->getParent()->getEntryBlock().begin());
       CurAST->add(AI);
     }
@@ -853,8 +853,7 @@
       continue;
     
     const Type *Ty = cast<PointerType>(V->getType())->getElementType();
-    AllocaInst *AI = new AllocaInst(*Context, Ty, 0,
-                                    V->getName()+".tmp", FnStart);
+    AllocaInst *AI = new AllocaInst(Ty, 0, V->getName()+".tmp", FnStart);
     PromotedValues.push_back(std::make_pair(AI, V));
 
     // Update the AST and alias analysis.

Modified: llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp Wed Jul 15 18:53:25 2009
@@ -89,7 +89,7 @@
         NumRegsDemoted += worklist.size();
         for (std::list<Instruction*>::iterator ilb = worklist.begin(), 
                ile = worklist.end(); ilb != ile; ++ilb)
-          DemoteRegToStack(*Context, **ilb, false, AllocaInsertionPoint);
+          DemoteRegToStack(**ilb, false, AllocaInsertionPoint);
 
         worklist.clear();
 
@@ -105,7 +105,7 @@
         NumPhisDemoted += worklist.size();
         for (std::list<Instruction*>::iterator ilb = worklist.begin(), 
                ile = worklist.end(); ilb != ile; ++ilb)
-          DemotePHIToStack(*Context, cast<PHINode>(*ilb), AllocaInsertionPoint);
+          DemotePHIToStack(cast<PHINode>(*ilb), AllocaInsertionPoint);
 
         return true;
       }

Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed Jul 15 18:53:25 2009
@@ -302,16 +302,14 @@
         DOUT << "CONVERT TO VECTOR: " << *AI << "  TYPE = " << *VectorTy <<"\n";
         
         // Create and insert the vector alloca.
-        NewAI = new AllocaInst(*Context, VectorTy, 0, "", 
-                               AI->getParent()->begin());
+        NewAI = new AllocaInst(VectorTy, 0, "",  AI->getParent()->begin());
         ConvertUsesToScalar(AI, NewAI, 0);
       } else {
         DOUT << "CONVERT TO SCALAR INTEGER: " << *AI << "\n";
         
         // Create and insert the integer alloca.
         const Type *NewTy = Context->getIntegerType(AllocaSize*8);
-        NewAI = new AllocaInst(*Context, NewTy, 0, "", 
-                               AI->getParent()->begin());
+        NewAI = new AllocaInst(NewTy, 0, "", AI->getParent()->begin());
         ConvertUsesToScalar(AI, NewAI, 0);
       }
       NewAI->takeName(AI);
@@ -336,8 +334,7 @@
   if (const StructType *ST = dyn_cast<StructType>(AI->getAllocatedType())) {
     ElementAllocas.reserve(ST->getNumContainedTypes());
     for (unsigned i = 0, e = ST->getNumContainedTypes(); i != e; ++i) {
-      AllocaInst *NA = new AllocaInst(*Context,
-                                      ST->getContainedType(i), 0, 
+      AllocaInst *NA = new AllocaInst(ST->getContainedType(i), 0, 
                                       AI->getAlignment(),
                                       AI->getName() + "." + utostr(i), AI);
       ElementAllocas.push_back(NA);
@@ -348,7 +345,7 @@
     ElementAllocas.reserve(AT->getNumElements());
     const Type *ElTy = AT->getElementType();
     for (unsigned i = 0, e = AT->getNumElements(); i != e; ++i) {
-      AllocaInst *NA = new AllocaInst(*Context, ElTy, 0, AI->getAlignment(),
+      AllocaInst *NA = new AllocaInst(ElTy, 0, AI->getAlignment(),
                                       AI->getName() + "." + utostr(i), AI);
       ElementAllocas.push_back(NA);
       WorkList.push_back(NA);  // Add to worklist for recursive processing

Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Wed Jul 15 18:53:25 2009
@@ -285,7 +285,7 @@
     if (I->isUsedOutsideOfBlock(DestBlock)) {
       // We found a use outside of the tail.  Create a new stack slot to
       // break this inter-block usage pattern.
-      DemoteRegToStack(*Context, *I);
+      DemoteRegToStack(*I);
     }
 
   // We are going to have to map operands from the original block B to the new

Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Wed Jul 15 18:53:25 2009
@@ -372,8 +372,7 @@
       StructValues.push_back(*i);
     } else {
       AllocaInst *alloca =
-        new AllocaInst(*codeReplacer->getContext(), 
-                       (*i)->getType(), 0, (*i)->getName()+".loc",
+        new AllocaInst((*i)->getType(), 0, (*i)->getName()+".loc",
                        codeReplacer->getParent()->begin()->begin());
       ReloadOutputs.push_back(alloca);
       params.push_back(alloca);
@@ -390,7 +389,7 @@
     // Allocate a struct at the beginning of this function
     Type *StructArgTy = Context->getStructType(ArgTypes);
     Struct =
-      new AllocaInst(*codeReplacer->getContext(), StructArgTy, 0, "structArg",
+      new AllocaInst(StructArgTy, 0, "structArg",
                      codeReplacer->getParent()->begin()->begin());
     params.push_back(Struct);
 

Modified: llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp Wed Jul 15 18:53:25 2009
@@ -29,8 +29,7 @@
 /// invalidating the SSA information for the value.  It returns the pointer to
 /// the alloca inserted to create a stack slot for I.
 ///
-AllocaInst* llvm::DemoteRegToStack(LLVMContext &Context, 
-                                   Instruction &I, bool VolatileLoads,
+AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
                                    Instruction *AllocaPoint) {
   if (I.use_empty()) {
     I.eraseFromParent();
@@ -40,11 +39,11 @@
   // Create a stack slot to hold the value.
   AllocaInst *Slot;
   if (AllocaPoint) {
-    Slot = new AllocaInst(Context, I.getType(), 0,
+    Slot = new AllocaInst(I.getType(), 0,
                           I.getName()+".reg2mem", AllocaPoint);
   } else {
     Function *F = I.getParent()->getParent();
-    Slot = new AllocaInst(Context, I.getType(), 0, I.getName()+".reg2mem",
+    Slot = new AllocaInst(I.getType(), 0, I.getName()+".reg2mem",
                           F->getEntryBlock().begin());
   }
   
@@ -109,8 +108,7 @@
 /// DemotePHIToStack - This function takes a virtual register computed by a phi
 /// node and replaces it with a slot in the stack frame, allocated via alloca.
 /// The phi node is deleted and it returns the pointer to the alloca inserted.
-AllocaInst* llvm::DemotePHIToStack(LLVMContext &Context, PHINode *P,
-                                   Instruction *AllocaPoint) {
+AllocaInst* llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
   if (P->use_empty()) {
     P->eraseFromParent();    
     return 0;                
@@ -119,11 +117,11 @@
   // Create a stack slot to hold the value.
   AllocaInst *Slot;
   if (AllocaPoint) {
-    Slot = new AllocaInst(Context, P->getType(), 0,
+    Slot = new AllocaInst(P->getType(), 0,
                           P->getName()+".reg2mem", AllocaPoint);
   } else {
     Function *F = P->getParent()->getParent();
-    Slot = new AllocaInst(Context, P->getType(), 0, P->getName()+".reg2mem",
+    Slot = new AllocaInst(P->getType(), 0, P->getName()+".reg2mem",
                           F->getEntryBlock().begin());
   }
   

Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Wed Jul 15 18:53:25 2009
@@ -309,7 +309,7 @@
         // Create the alloca.  If we have TargetData, use nice alignment.
         unsigned Align = 1;
         if (TD) Align = TD->getPrefTypeAlignment(AggTy);
-        Value *NewAlloca = new AllocaInst(*Context, AggTy, 0, Align, 
+        Value *NewAlloca = new AllocaInst(AggTy, 0, Align, 
                                           I->getName(), 
                                           &*Caller->begin()->begin());
         // Emit a memcpy.

Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Wed Jul 15 18:53:25 2009
@@ -417,7 +417,7 @@
       // If we decided we need a spill, do it.
       if (NeedsSpill) {
         ++NumSpilled;
-        DemoteRegToStack(*Context, *Inst, true);
+        DemoteRegToStack(*Inst, true);
       }
     }
 }
@@ -470,7 +470,7 @@
     // alloca because the value needs to be live across invokes.
     unsigned Align = TLI ? TLI->getJumpBufAlignment() : 0;
     AllocaInst *JmpBuf =
-      new AllocaInst(*Context, JBLinkTy, 0, Align,
+      new AllocaInst(JBLinkTy, 0, Align,
                      "jblink", F.begin()->begin());
 
     std::vector<Value*> Idx;
@@ -494,7 +494,7 @@
 
     // Create an alloca which keeps track of which invoke is currently
     // executing.  For normal calls it contains zero.
-    AllocaInst *InvokeNum = new AllocaInst(*Context, Type::Int32Ty, 0,
+    AllocaInst *InvokeNum = new AllocaInst(Type::Int32Ty, 0,
                                            "invokenum",EntryBB->begin());
     new StoreInst(Context->getConstantInt(Type::Int32Ty, 0), InvokeNum, true,
                   EntryBB->getTerminator());

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=75863&r1=75862&r2=75863&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Wed Jul 15 18:53:25 2009
@@ -712,25 +712,21 @@
   return Amt;
 }
 
-AllocationInst::AllocationInst(LLVMContext &C, 
-                               const Type *Ty, Value *ArraySize, unsigned iTy,
+AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
                                unsigned Align, const std::string &Name,
                                Instruction *InsertBefore)
-  : UnaryInstruction(PointerType::getUnqual(Ty), iTy,
-                     getAISize(Context, ArraySize), InsertBefore),
-    Context(C) {
+  : UnaryInstruction(Ty->getContext().getPointerTypeUnqual(Ty), iTy,
+                     getAISize(Ty->getContext(), ArraySize), InsertBefore) {
   setAlignment(Align);
   assert(Ty != Type::VoidTy && "Cannot allocate void!");
   setName(Name);
 }
 
-AllocationInst::AllocationInst(LLVMContext &C,
-                               const Type *Ty, Value *ArraySize, unsigned iTy,
+AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
                                unsigned Align, const std::string &Name,
                                BasicBlock *InsertAtEnd)
-  : UnaryInstruction(PointerType::getUnqual(Ty), iTy,
-                     getAISize(Context, ArraySize), InsertAtEnd),
-    Context(C) {
+  : UnaryInstruction(Ty->getContext().getPointerTypeUnqual(Ty), iTy,
+                     getAISize(Ty->getContext(), ArraySize), InsertAtEnd) {
   setAlignment(Align);
   assert(Ty != Type::VoidTy && "Cannot allocate void!");
   setName(Name);
@@ -757,7 +753,7 @@
 }
 
 AllocaInst::AllocaInst(const AllocaInst &AI)
-  : AllocationInst(AI.Context, AI.getType()->getElementType(),    
+  : AllocationInst(AI.getType()->getElementType(),    
                    (Value*)AI.getOperand(0), Instruction::Alloca,
                    AI.getAlignment()) {
 }
@@ -775,7 +771,7 @@
 }
 
 MallocInst::MallocInst(const MallocInst &MI)
-  : AllocationInst(MI.Context, MI.getType()->getElementType(), 
+  : AllocationInst(MI.getType()->getElementType(), 
                    (Value*)MI.getOperand(0), Instruction::Malloc,
                    MI.getAlignment()) {
 }





More information about the llvm-commits mailing list