diff options
author | Chris Lattner <sabre@nondot.org> | 2001-12-14 16:32:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-12-14 16:32:20 +0000 |
commit | 206ad80ef96ed6d9b4d2f8e4711a39df1278eb47 (patch) | |
tree | 64a84202b20a10a6c0c722cda988118db9341694 | |
parent | 5618cb60c212c0d26fb5a4120c460ee1ae9ef15e (diff) | |
download | external_llvm-206ad80ef96ed6d9b4d2f8e4711a39df1278eb47.zip external_llvm-206ad80ef96ed6d9b4d2f8e4711a39df1278eb47.tar.gz external_llvm-206ad80ef96ed6d9b4d2f8e4711a39df1278eb47.tar.bz2 |
The proper prototype for malloc returns a pointer, not an unsized array
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1463 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/IPO/DeadTypeElimination.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index e194bf4..ec4c3fd 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -24,7 +24,6 @@ #include "llvm/iOther.h" #include <algorithm> -static const Type *PtrArrSByte = 0; // '[sbyte]*' type static const Type *PtrSByte = 0; // 'sbyte*' type // ConvertCallTo - Convert a call to a varargs function with no arg types @@ -226,10 +225,8 @@ bool CleanupGCCOutput::doPassInitialization(Module *M) { FUT.doPassInitialization(M); - if (PtrArrSByte == 0) { - PtrArrSByte = PointerType::get(ArrayType::get(Type::SByteTy)); - PtrSByte = PointerType::get(Type::SByteTy); - } + if (PtrSByte == 0) + PtrSByte = PointerType::get(Type::SByteTy); if (M->hasSymbolTable()) { SymbolTable *ST = M->getSymbolTable(); @@ -304,7 +301,7 @@ bool CleanupGCCOutput::doOneCleanupPass(Method *M) { if (CallInst *CI = dyn_cast<CallInst>(I)) { if (CI->getCalledValue() == Malloc) { // Replace call to malloc? - MallocInst *MallocI = new MallocInst(PtrArrSByte, CI->getOperand(1), + MallocInst *MallocI = new MallocInst(PtrSByte, CI->getOperand(1), CI->getName()); CI->setName(""); BI = BIL.insert(BI, MallocI)+1; |