summaryrefslogtreecommitdiff
path: root/lib/Analysis/MemoryBuiltins.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-06-21 16:47:58 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-06-21 16:47:58 +0000
commit034dd6c6a118cf78ebfa6bf3496cd5b0df578a9e (patch)
tree6d9f8dd60938d01252246410d302c4afad75a9fe /lib/Analysis/MemoryBuiltins.cpp
parent7f5847270a650614b45f756e1a86502613be4921 (diff)
downloadllvm-034dd6c6a118cf78ebfa6bf3496cd5b0df578a9e.tar.gz
llvm-034dd6c6a118cf78ebfa6bf3496cd5b0df578a9e.tar.bz2
llvm-034dd6c6a118cf78ebfa6bf3496cd5b0df578a9e.tar.xz
hopefully fix the buildbots: some tests have wrong definitions of malloc and were crashing this code on 64 bits machines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryBuiltins.cpp')
-rw-r--r--lib/Analysis/MemoryBuiltins.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp
index 2a1afdce32..436cffd6e8 100644
--- a/lib/Analysis/MemoryBuiltins.cpp
+++ b/lib/Analysis/MemoryBuiltins.cpp
@@ -419,7 +419,7 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitCallSite(CallSite CS) {
if (!Arg)
return unknown();
- APInt Size = Arg->getValue();
+ APInt Size = Arg->getValue().zextOrSelf(IntTyBits);
// size determined by just 1 parameter
if (FnData->SndParam == (unsigned char)-1)
return std::make_pair(Size, Zero);
@@ -428,7 +428,7 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitCallSite(CallSite CS) {
if (!Arg)
return unknown();
- Size *= Arg->getValue();
+ Size *= Arg->getValue().zextOrSelf(IntTyBits);
return std::make_pair(Size, Zero);
// TODO: handle more standard functions (+ wchar cousins):
@@ -602,11 +602,13 @@ SizeOffsetEvalType ObjectSizeOffsetEvaluator::visitCallSite(CallSite CS) {
return unknown();
}
- Value *FirstArg = CS.getArgument(FnData->FstParam);
+ Value *FirstArg = CS.getArgument(FnData->FstParam);
+ FirstArg = Builder.CreateZExt(FirstArg, IntTy);
if (FnData->SndParam == (unsigned char)-1)
return std::make_pair(FirstArg, Zero);
Value *SecondArg = CS.getArgument(FnData->SndParam);
+ SecondArg = Builder.CreateZExt(SecondArg, IntTy);
Value *Size = Builder.CreateMul(FirstArg, SecondArg);
return std::make_pair(Size, Zero);