[llvm-commits] [poolalloc] r133687 - /poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Wed Jun 22 22:29:26 PDT 2011
Author: aggarwa4
Date: Thu Jun 23 00:29:26 2011
New Revision: 133687
URL: http://llvm.org/viewvc/llvm-project?rev=133687&view=rev
Log:
Remove calls to getTagType on optimization.
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=133687&r1=133686&r2=133687&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecksOpt.cpp Thu Jun 23 00:29:26 2011
@@ -51,6 +51,7 @@
static Constant *copyTypeInfo;
static Constant *setTypeInfo;
static Constant *checkTypeInst;
+static Constant *getTypeTag;
static Constant *MallocFunc;
bool TypeChecksOpt::runOnModule(Module &M) {
@@ -118,6 +119,12 @@
VoidPtrTy,
Int32Ty,
NULL);
+ getTypeTag = M.getOrInsertFunction("getTypeTag",
+ VoidTy,
+ VoidPtrTy, /*ptr*/
+ Int64Ty, /*size*/
+ TypeTagPtrTy, /*dest for type tag*/
+ NULL);
MallocFunc = M.getFunction("malloc");
for(Value::use_iterator User = trackGlobal->use_begin(); User != trackGlobal->use_end(); ++User) {
@@ -214,6 +221,14 @@
}
}
+ for(Value::use_iterator User = getTypeTag->use_begin(); User != getTypeTag->use_end(); ++User) {
+ CallInst *CI = dyn_cast<CallInst>(User);
+ assert(CI);
+ if(TS->isTypeSafe(CI->getOperand(1)->stripPointerCasts(), CI->getParent()->getParent())) {
+ toDelete.push_back(CI);
+ }
+ }
+
numSafe += toDelete.size();
while(!toDelete.empty()) {
More information about the llvm-commits
mailing list