Use type form of getIntPtrType in alloca visitor.
[oota-llvm.git] / lib / Transforms / InstCombine / InstCombineLoadStoreAlloca.cpp
index 58c61e7de9fb17477a319088991cdaa86cd897f5..4c382a366d65631e7f7ec4477d80dea02048102e 100644 (file)
@@ -154,7 +154,7 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
   // Ensure that the alloca array size argument has type intptr_t, so that
   // any casting is exposed early.
   if (TD) {
-    Type *IntPtrTy = TD->getIntPtrType(AI.getContext());
+    Type *IntPtrTy = TD->getIntPtrType(AI.getType());
     if (AI.getArraySize()->getType() != IntPtrTy) {
       Value *V = Builder->CreateIntCast(AI.getArraySize(),
                                         IntPtrTy, false);
@@ -181,7 +181,7 @@ Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
       // insert our getelementptr instruction...
       //
       Type *IdxTy = TD
-                  ? TD->getIntPtrType(AI.getContext())
+                  ? TD->getIntPtrType(AI.getType())
                   : Type::getInt64Ty(AI.getContext());
       Value *NullIdx = Constant::getNullValue(IdxTy);
       Value *Idx[2] = { NullIdx, NullIdx };