(hopefuly) fix the remaining cases where null wasnt expected (PR13497).
authorNuno Lopes <nunoplopes@sapo.pt>
Wed, 1 Aug 2012 16:58:51 +0000 (16:58 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Wed, 1 Aug 2012 16:58:51 +0000 (16:58 +0000)
I'll commit a test to the clang tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161118 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/BuildLibCalls.cpp

index 1ebd5b7061c127d790d034db307b3874e080665e..89949bb2a287cb9a2fa81704f0e2528fe3a87aae 100644 (file)
@@ -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;
     }