summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-25 07:06:48 +0000
committerChris Lattner <sabre@nondot.org>2005-09-25 07:06:48 +0000
commitaebac50e776933bd6fb4f04e3c6c79d6fb7dab81 (patch)
tree0c65b76e3d81861946fe7c060976814b2b6490aa /lib
parent5931c54e85ae7f541bb4f2446d4735e55232d3e6 (diff)
downloadexternal_llvm-aebac50e776933bd6fb4f04e3c6c79d6fb7dab81.zip
external_llvm-aebac50e776933bd6fb4f04e3c6c79d6fb7dab81.tar.gz
external_llvm-aebac50e776933bd6fb4f04e3c6c79d6fb7dab81.tar.bz2
Fix some logic I broke that caused a regression on
SimplifyLibCalls/2005-05-20-sprintf-crash.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp
index a11bde1..ae76a4d 100644
--- a/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/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;
}