Fix some logic I broke that caused a regression on

SimplifyLibCalls/2005-05-20-sprintf-crash.ll

llvm-svn: 23430
This commit is contained in:
Chris Lattner 2005-09-25 07:06:48 +00:00
parent 0b3557f54a
commit f487768062
1 changed files with 5 additions and 3 deletions

View File

@ -1500,9 +1500,11 @@ public:
new CallInst(memcpy_func, args, "", ci);
// The strlen result is the unincremented number of bytes in the string.
if (!ci->use_empty() && Len->getType() != ci->getType())
Len = new CastInst(Len, ci->getType(), Len->getName(), ci);
ci->replaceAllUsesWith(Len);
if (!ci->use_empty()) {
if (Len->getType() != ci->getType())
Len = new CastInst(Len, ci->getType(), Len->getName(), ci);
ci->replaceAllUsesWith(Len);
}
ci->eraseFromParent();
return true;
}