Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.
llvm-svn: 3710
diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
index 241e1f5..bf83007 100644
--- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -113,7 +113,6 @@
if (CallInst *CI = dyn_cast<CallInst>(I)) {
if (CI->getCalledValue() == MallocFunc) { // Replace call to malloc?
- const Type *PtrSByte = PointerType::get(Type::SByteTy);
Value *Source = CI->getOperand(1);
// If no prototype was provided for malloc, we may need to cast the
@@ -122,7 +121,7 @@
Source = new CastInst(Source, Type::UIntTy, "MallocAmtCast", BI);
std::string Name(CI->getName()); CI->setName("");
- BI = new MallocInst(PtrSByte, Source, Name, BI);
+ BI = new MallocInst(Type::SByteTy, Source, Name, BI);
CI->replaceAllUsesWith(BI);
BIL.erase(I);
Changed = true;