Delete a directory that wasn't supposed to be checked in yet.
authorMicah Villmow <villmow@gmail.com>
Wed, 24 Oct 2012 17:20:04 +0000 (17:20 +0000)
committerMicah Villmow <villmow@gmail.com>
Wed, 24 Oct 2012 17:20:04 +0000 (17:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166591 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
examples/ExceptionDemo/ExceptionDemo.cpp
include/llvm/Type.h
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
lib/Transforms/Instrumentation/GCOVProfiling.cpp
lib/Transforms/Instrumentation/ProfilingUtils.cpp
lib/Transforms/Instrumentation/ThreadSanitizer.cpp
lib/Transforms/Scalar/SROA.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
lib/VMCore/Constants.cpp
lib/VMCore/Type.cpp
lib/VMCore/Verifier.cpp

index 215cb4d3714fb56a1ce190c3a35b1b7009b76553..89471473cb32479794c443df752a6e19ad4adf66 100644 (file)
@@ -1268,7 +1268,7 @@ llvm::Function *createCatchWrappedInvokeFunction(llvm::Module &module,
   llvm::Value *unwindExceptionClass =
     builder.CreateLoad(builder.CreateStructGEP(
              builder.CreatePointerCast(unwindException,
-                                       ourUnwindExceptionType->getPointerTo()),
+                                       ourUnwindExceptionType->getPointerTo(0)),
                                                0));
 
   // Branch to the externalExceptionBlock if the exception is foreign or
index 5a867045af81e47f739e9621880952e5b6223361..2c1313afbef55091d5944ee9231e436c4648cc02 100644 (file)
@@ -389,10 +389,16 @@ public:
   static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0);
   static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0);
 
-  /// getPointerTo - Return a pointer to the current type.  This is equivalent
-  /// to PointerType::get(Foo, AddrSpace).
-  PointerType *getPointerTo(unsigned AddrSpace = 0);
+  /// getPointerTo - Return a pointer to the current type for the given address space.
+  /// This is equivalent to PointerType::get(Foo, AddrSpace).
+  PointerType *getPointerTo(unsigned AddrSpace);
 
+  /// getPointerTo - Return a pointer to the current type for the address space
+  /// space of the passed in type.
+  PointerType *getPointerTo(const Type *Ty);
+
+  /// getPointerTo - Retrun a pointer to the current type.
+  PointerType *getPointerTo();
 private:
   /// isSizedDerivedType - Derived types like structures and arrays are sized
   /// iff all of the members of the type are sized as well.  Since asking for
index abf40b77a18f080d84759d686867f92c396f13e8..dd8edc2836eede830285dc7cbfe270df3796a083 100644 (file)
@@ -2068,7 +2068,7 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
   // Also pass the return address of the remainder.
   SDValue FIPtr = DAG.CreateStackTemporary(RetVT);
   Entry.Node = FIPtr;
-  Entry.Ty = RetTy->getPointerTo();
+  Entry.Ty = RetTy->getPointerTo(0);
   Entry.isSExt = isSigned;
   Entry.isZExt = !isSigned;
   Args.push_back(Entry);
index a370faeb2399f83f44539a9eb591cb251a3b7185..7285e88cab275e762666c969ce066c96a92669e1 100644 (file)
@@ -2320,7 +2320,7 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
 
   // Also pass the address of the overflow check.
   Entry.Node = Temp;
-  Entry.Ty = PtrTy->getPointerTo();
+  Entry.Ty = PtrTy->getPointerTo(0);
   Entry.isSExt = true;
   Entry.isZExt = false;
   Args.push_back(Entry);
index e9192e5cdd52bda9f63aa4a26a0ddfd686cac8fc..3998c8bb2293281d4604ddeaee6788c5c41e7b53 100644 (file)
@@ -586,8 +586,8 @@ Constant *GCOVProfiler::getIncrementIndirectCounterFunc() {
   Type *Int32Ty = Type::getInt32Ty(*Ctx);
   Type *Int64Ty = Type::getInt64Ty(*Ctx);
   Type *Args[] = {
-    Int32Ty->getPointerTo(),                // uint32_t *predecessor
-    Int64Ty->getPointerTo()->getPointerTo() // uint64_t **counters
+    Int32Ty->getPointerTo(Int32Ty),                // uint32_t *predecessor
+    Int64Ty->getPointerTo(Int64Ty)->getPointerTo(Int64Ty) // uint64_t **counters
   };
   FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Ctx), Args, false);
   return M->getOrInsertFunction("__llvm_gcov_indirect_counter_increment", FTy);
@@ -733,7 +733,8 @@ void GCOVProfiler::insertIndirectCounterIncrement() {
   Value *GEP = Builder.CreateGEP(Arg, ZExtPred);
   Value *Counter = Builder.CreateLoad(GEP, "counter");
   Cond = Builder.CreateICmpEQ(Counter,
-                              Constant::getNullValue(Int64Ty->getPointerTo()));
+                              Constant::getNullValue(
+                                Int64Ty->getPointerTo(Counter->getType())));
   Builder.CreateCondBr(Cond, Exit, CounterEnd);
 
   // ++*counter;
index de57cd1734830fae1b4e2d6b2a1467bfad82fe7c..40aa2274a4ff43380509b2b9500ef463eb376fec 100644 (file)
@@ -134,7 +134,8 @@ void llvm::InsertProfilingShutdownCall(Function *Callee, Module *Mod) {
   // types.
   Type *GlobalDtorElems[2] = {
     Type::getInt32Ty(Mod->getContext()),
-    FunctionType::get(Type::getVoidTy(Mod->getContext()), false)->getPointerTo()
+    FunctionType::get(Type::getVoidTy(Mod->getContext()), false)
+      ->getPointerTo()
   };
   StructType *GlobalDtorElemTy =
       StructType::get(Mod->getContext(), GlobalDtorElems, false);
index c6244a55c9369ee65f9ac72e566008546bd2870d..8536e9a41a2e6609de04f1694f2d1bde785471d8 100644 (file)
@@ -375,7 +375,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) {
     const size_t ByteSize = 1 << Idx;
     const size_t BitSize = ByteSize * 8;
     Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize);
-    Type *PtrTy = Ty->getPointerTo();
+    Type *PtrTy = Ty->getPointerTo(Addr->getType());
     Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
                      createOrdering(&IRB, LI->getOrdering())};
     CallInst *C = CallInst::Create(TsanAtomicLoad[Idx],
@@ -390,7 +390,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) {
     const size_t ByteSize = 1 << Idx;
     const size_t BitSize = ByteSize * 8;
     Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize);
-    Type *PtrTy = Ty->getPointerTo();
+    Type *PtrTy = Ty->getPointerTo(Addr->getType());
     Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
                      IRB.CreateIntCast(SI->getValueOperand(), Ty, false),
                      createOrdering(&IRB, SI->getOrdering())};
index 71c62257e7f64b85aee702b23f59d967147b3ebe..adf7e7af83ed674d841fccdfee4d6f559eca9ee2 100644 (file)
@@ -2763,9 +2763,9 @@ private:
                               : II.getRawDest()->getType();
     if (!EmitMemCpy) {
       if (IsVectorElement)
-        OtherPtrTy = VecTy->getElementType()->getPointerTo();
+        OtherPtrTy = VecTy->getElementType()->getPointerTo(OtherPtrTy);
       else if (IntTy && !IsWholeAlloca)
-        OtherPtrTy = SubIntTy->getPointerTo();
+        OtherPtrTy = SubIntTy->getPointerTo(OtherPtrTy);
       else
         OtherPtrTy = NewAI.getType();
     }
index bead39225b82e0955eda923e3adec2c951a75579..4cd171ab140b7a61c7b2dc7ddf7d23494d559c3e 100644 (file)
@@ -777,7 +777,7 @@ SingleBlockLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) {
         GetElementPtrInst *Gep2 = cast<GetElementPtrInst>(Gep->clone());
         Gep2->setOperand(NumOperands - 1, LastIndex);
         Ptr = Builder.Insert(Gep2);
-        Ptr = Builder.CreateBitCast(Ptr, StTy->getPointerTo());
+        Ptr = Builder.CreateBitCast(Ptr, StTy->getPointerTo(Ptr->getType()));
         Value *Val = getVectorValue(SI->getValueOperand());
         Builder.CreateStore(Val, Ptr)->setAlignment(Alignment);
         break;
@@ -806,7 +806,7 @@ SingleBlockLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) {
         GetElementPtrInst *Gep2 = cast<GetElementPtrInst>(Gep->clone());
         Gep2->setOperand(NumOperands - 1, LastIndex);
         Ptr = Builder.Insert(Gep2);
-        Ptr = Builder.CreateBitCast(Ptr, RetTy->getPointerTo());
+        Ptr = Builder.CreateBitCast(Ptr, RetTy->getPointerTo(Ptr->getType()));
         LI = Builder.CreateLoad(Ptr);
         LI->setAlignment(Alignment);
         // Use this vector value for all users of the load.
index a4e21e16b3fcfb31f2e9774656738f34cf4eb0f6..b96257936df880144dd7495f15f8c2f2dd1f70dd 100644 (file)
@@ -1673,7 +1673,7 @@ Constant *ConstantExpr::getAlignOf(Type* Ty) {
   // Note that a non-inbounds gep is used, as null isn't within any object.
   Type *AligningTy = 
     StructType::get(Type::getInt1Ty(Ty->getContext()), Ty, NULL);
-  Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo());
+  Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo(Ty));
   Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0);
   Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
   Constant *Indices[2] = { Zero, One };
index 54146e118c9da266b6ad059853b304a6dc922472..13fae3327be5c5dd9896972678be47c24a74d2ee 100644 (file)
@@ -779,6 +779,28 @@ PointerType *Type::getPointerTo(unsigned addrs) {
   return PointerType::get(this, addrs);
 }
 
+PointerType *Type::getPointerTo(const Type *Ty) {
+  unsigned AS = 0;
+  // For pointers, we return a new pointer based on the address space.
+  if (Ty->isPointerTy()) AS = Ty->getPointerAddressSpace();
+  // For vector of pointers, we return a new pointer based on the
+  // address space of the element pointer type.
+  if (Ty->isVectorTy())
+    AS = Ty->getVectorElementType()->getPointerAddressSpace();
+  // Otherwise return a pointer based on the default address space
+  // since we want a pointer to the current type without having
+  // a type that can give us the correct address space.
+  // An example of this occuring is that you want to get a pointer to 
+  // all of the arguments in a function. However, the PointerType
+  // for a non-pointer type cannot be determined by the type, so
+  // the default value is used.
+  return getPointerTo(AS);
+}
+
+PointerType *Type::getPointerTo() {
+  return getPointerTo(this);
+}
+
 bool PointerType::isValidElementType(Type *ElemTy) {
   return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
          !ElemTy->isMetadataTy();
index eb40b09d29f70bba36d8063103c1553c954d0a6e..23f4e54328bedea50096278a83abbead347ad2da 100644 (file)
@@ -434,7 +434,8 @@ void Verifier::visitGlobalVariable(GlobalVariable &GV) {
     if (ArrayType *ATy = dyn_cast<ArrayType>(GV.getType())) {
       StructType *STy = dyn_cast<StructType>(ATy->getElementType());
       PointerType *FuncPtrTy =
-          FunctionType::get(Type::getVoidTy(*Context), false)->getPointerTo();
+          FunctionType::get(Type::getVoidTy(*Context), false)
+          ->getPointerTo(GV.getType());
       Assert1(STy && STy->getNumElements() == 2 &&
               STy->getTypeAtIndex(0u)->isIntegerTy(32) &&
               STy->getTypeAtIndex(1) == FuncPtrTy,