diff options
author | Owen Anderson <resistor@mac.com> | 2009-08-13 23:27:32 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-08-13 23:27:32 +0000 |
commit | a42ac6953be3cd9ff25310c9dcb51f3df0e2f6e1 (patch) | |
tree | a6e4594b64450c9cbe6bfdbea5769076e2ca2097 /llvm/lib/Analysis/PointerTracking.cpp | |
parent | 590a7c780caa2429349d364923ca55d5f3bd3e6b (diff) | |
download | bcm5719-llvm-a42ac6953be3cd9ff25310c9dcb51f3df0e2f6e1.tar.gz bcm5719-llvm-a42ac6953be3cd9ff25310c9dcb51f3df0e2f6e1.zip |
Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
llvm-svn: 78955
Diffstat (limited to 'llvm/lib/Analysis/PointerTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/PointerTracking.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/PointerTracking.cpp b/llvm/lib/Analysis/PointerTracking.cpp index f2154f73889..d28e58e1013 100644 --- a/llvm/lib/Analysis/PointerTracking.cpp +++ b/llvm/lib/Analysis/PointerTracking.cpp @@ -104,12 +104,12 @@ const SCEV *PointerTracking::computeAllocationCount(Value *P, Constant *C = GV->getInitializer(); if (const ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) { Ty = ATy->getElementType(); - return SE->getConstant(Type::getInt32Ty(Ty->getContext()), + return SE->getConstant(Type::getInt32Ty(P->getContext()), ATy->getNumElements()); } } Ty = GV->getType(); - return SE->getConstant(Type::getInt32Ty(Ty->getContext()), 1); + return SE->getConstant(Type::getInt32Ty(P->getContext()), 1); //TODO: implement more tracking for globals } @@ -118,13 +118,13 @@ const SCEV *PointerTracking::computeAllocationCount(Value *P, Function *F = dyn_cast<Function>(CS.getCalledValue()->stripPointerCasts()); const Loop *L = LI->getLoopFor(CI->getParent()); if (F == callocFunc) { - Ty = Type::getInt8Ty(Ty->getContext()); + Ty = Type::getInt8Ty(P->getContext()); // calloc allocates arg0*arg1 bytes. return SE->getSCEVAtScope(SE->getMulExpr(SE->getSCEV(CS.getArgument(0)), SE->getSCEV(CS.getArgument(1))), L); } else if (F == reallocFunc) { - Ty = Type::getInt8Ty(Ty->getContext()); + Ty = Type::getInt8Ty(P->getContext()); // realloc allocates arg1 bytes. return SE->getSCEVAtScope(CS.getArgument(1), L); } |