aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 a11bde10a6..ae76a4d11b 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;
}