From d8febfc4aa2ea96b174a4302e6d3bcd3f2c666b0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 25 Sep 2005 07:06:48 +0000 Subject: [PATCH] Fix some logic I broke that caused a regression on SimplifyLibCalls/2005-05-20-sprintf-crash.ll llvm-svn: 23430 --- lib/Transforms/IPO/SimplifyLibCalls.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index a11bde10a6b..ae76a4d11bc 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; }