diff options
author | Chris Lattner <sabre@nondot.org> | 2005-09-25 07:06:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-09-25 07:06:48 +0000 |
commit | f487768062daa23d340d731a96470f4a7976af2f (patch) | |
tree | 386756e962596f4ede0a8366e54da43c39dd438d /llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp | |
parent | 0b3557f54a99e0719bd4c586f6455c2052f6c1e3 (diff) | |
download | bcm5719-llvm-f487768062daa23d340d731a96470f4a7976af2f.tar.gz bcm5719-llvm-f487768062daa23d340d731a96470f4a7976af2f.zip |
Fix some logic I broke that caused a regression on
SimplifyLibCalls/2005-05-20-sprintf-crash.ll
llvm-svn: 23430
Diffstat (limited to 'llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp index a11bde10a6b..ae76a4d11bc 100644 --- a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -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; } |