aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-08-01 16:58:51 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-08-01 16:58:51 +0000
commite7220312c2fa115c513d9cc22089900fc959e83d (patch)
tree23cc55c78d1a8a5f0d2d669fa6003b8d7a5a7a60 /llvm/lib/Transforms/Utils/BuildLibCalls.cpp
parent7947aecaf1e27e19d3e2317e52eace478096d2f6 (diff)
downloadllvm-e7220312c2fa115c513d9cc22089900fc959e83d.zip
llvm-e7220312c2fa115c513d9cc22089900fc959e83d.tar.gz
llvm-e7220312c2fa115c513d9cc22089900fc959e83d.tar.bz2
(hopefuly) fix the remaining cases where null wasnt expected (PR13497).
I'll commit a test to the clang tree. llvm-svn: 161118
Diffstat (limited to 'llvm/lib/Transforms/Utils/BuildLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BuildLibCalls.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 1ebd5b7..89949bb 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -526,6 +526,8 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD,
if (isFoldable(2, 1, true)) {
Value *Ret = EmitStrCpy(CI->getArgOperand(0), CI->getArgOperand(1), B, TD,
TLI, Name.substr(2, 6));
+ if (!Ret)
+ return false;
replaceCall(Ret);
return true;
}
@@ -545,6 +547,8 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD,
Value *Ret = EmitStrNCpy(CI->getArgOperand(0), CI->getArgOperand(1),
CI->getArgOperand(2), B, TD, TLI,
Name.substr(2, 7));
+ if (!Ret)
+ return false;
replaceCall(Ret);
return true;
}