From 9ed7b16bf33d191c4f58f41b128aded092cc4ea0 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Tue, 6 Oct 2009 15:40:36 +0000 Subject: Introduce and use convenience methods for getting pointer types where the element is of a basic builtin type. For example, to get an i8* use getInt8PtrTy. llvm-svn: 83379 --- llvm/lib/Transforms/Utils/LowerAllocations.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms/Utils/LowerAllocations.cpp') diff --git a/llvm/lib/Transforms/Utils/LowerAllocations.cpp b/llvm/lib/Transforms/Utils/LowerAllocations.cpp index 2df953c1499..f26d7c146ee 100644 --- a/llvm/lib/Transforms/Utils/LowerAllocations.cpp +++ b/llvm/lib/Transforms/Utils/LowerAllocations.cpp @@ -87,7 +87,7 @@ Pass *llvm::createLowerAllocationsPass(bool LowerMallocArgToInteger) { // This function is always successful. // bool LowerAllocations::doInitialization(Module &M) { - const Type *BPTy = PointerType::getUnqual(Type::getInt8Ty(M.getContext())); + const Type *BPTy = Type::getInt8PtrTy(M.getContext()); FreeFunc = M.getOrInsertFunction("free" , Type::getVoidTy(M.getContext()), BPTy, (Type *)0); return true; @@ -123,7 +123,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { } else if (FreeInst *FI = dyn_cast(I)) { Value *PtrCast = new BitCastInst(FI->getOperand(0), - PointerType::getUnqual(Type::getInt8Ty(BB.getContext())), "", I); + Type::getInt8PtrTy(BB.getContext()), "", I); // Insert a call to the free function... CallInst::Create(FreeFunc, PtrCast, "", I)->setTailCall(); -- cgit v1.2.3