[llvm-commits] [poolalloc] r133719 - /poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Thu Jun 23 08:12:30 PDT 2011
Author: aggarwa4
Date: Thu Jun 23 10:12:30 2011
New Revision: 133719
URL: http://llvm.org/viewvc/llvm-project?rev=133719&view=rev
Log:
Fix prototype for getTypeTag.
Also, if the src pointer for the getTypeTag is
typesafe, set the metadata to TOP.
Modified:
poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp
Modified: poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp?rev=133719&r1=133718&r2=133719&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp Thu Jun 23 10:12:30 2011
@@ -124,6 +124,7 @@
VoidPtrTy, /*ptr*/
Int64Ty, /*size*/
TypeTagPtrTy, /*dest for type tag*/
+ Int32Ty, /*tag*/
NULL);
MallocFunc = M.getFunction("malloc");
@@ -225,6 +226,20 @@
CallInst *CI = dyn_cast<CallInst>(User);
assert(CI);
if(TS->isTypeSafe(CI->getOperand(1)->stripPointerCasts(), CI->getParent()->getParent())) {
+ Constant *memsetF = M.getOrInsertFunction ("llvm.memset.i64", VoidTy,
+ VoidPtrTy,
+ Int8Ty,
+ Int64Ty,
+ Int32Ty,
+ NULL);
+ AllocaInst *AI = dyn_cast<AllocaInst>(CI->getOperand(3)->stripPointerCasts());
+ assert(AI);
+ std::vector<Value*>Args;
+ Args.push_back(CI->getOperand(3));
+ Args.push_back(ConstantInt::get(Int8Ty, 1));
+ Args.push_back(CI->getOperand(2));
+ Args.push_back(ConstantInt::get(Int32Ty, AI->getAlignment()));
+ CallInst::Create(memsetF, Args.begin(), Args.end(), "", CI);
toDelete.push_back(CI);
}
}
More information about the llvm-commits
mailing list