From: Chris Lattner Date: Sun, 25 Sep 2005 07:06:48 +0000 (+0000) Subject: Fix some logic I broke that caused a regression on X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=aebac50e776933bd6fb4f04e3c6c79d6fb7dab81 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 --- 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; }