[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 1 09:53:02 PDT 2005
Changes in directory llvm/lib/Transforms/IPO:
SimplifyLibCalls.cpp updated: 1.46 -> 1.47
---
Log message:
ConstantInt::get only works for arguments < 128.
SimplifyLibCalls probably has to be audited to make sure it does not make
this mistake elsewhere. Also, if this code knows that the type will be
unsigned, obviously one arm of this is dead.
Reid, can you take a look into this further?
---
Diffs of the changes: (+6 -2)
SimplifyLibCalls.cpp | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.46 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.47
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.46 Wed Jul 27 01:12:34 2005
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Mon Aug 1 11:52:50 2005
@@ -962,8 +962,12 @@
return false;
// strlen("xyz") -> 3 (for example)
- ci->replaceAllUsesWith(
- ConstantInt::get(SLC.getTargetData()->getIntPtrType(),len));
+ const Type *Ty = SLC.getTargetData()->getIntPtrType();
+ if (Ty->isSigned())
+ ci->replaceAllUsesWith(ConstantSInt::get(Ty, len));
+ else
+ ci->replaceAllUsesWith(ConstantUInt::get(Ty, len));
+
ci->eraseFromParent();
return true;
}
More information about the llvm-commits
mailing list