[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Sep 25 00:06:59 PDT 2005



Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.50 -> 1.51
---
Log message:

Fix some logic I broke that caused a regression on 
SimplifyLibCalls/2005-05-20-sprintf-crash.ll


---
Diffs of the changes:  (+5 -3)

 SimplifyLibCalls.cpp |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.50 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.51
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.50	Sat Sep 24 17:17:06 2005
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp	Sun Sep 25 02:06:48 2005
@@ -1500,9 +1500,11 @@
       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;
     }






More information about the llvm-commits mailing list