summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-03-13 04:39:26 +0000
committerBill Wendling <isanbard@gmail.com>2009-03-13 04:39:26 +0000
commitfa54bc2052d4f1aa3fdb57a5238e73d4a62826a3 (patch)
tree046ffd9fa3dd9abd1e78a7ec28e4f64031eb44b2 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parentb02eadf660f98b621d63fc60374d160aa4d53cec (diff)
downloadbcm5719-llvm-fa54bc2052d4f1aa3fdb57a5238e73d4a62826a3.tar.gz
bcm5719-llvm-fa54bc2052d4f1aa3fdb57a5238e73d4a62826a3.zip
Oops...I committed too much.
llvm-svn: 66867
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 8e8962928dd..b2a68641940 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11043,12 +11043,11 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(CI)) {
// Instead of loading constant c string, use corresponding integer value
// directly if string length is small enough.
- const char *Str = GetConstantStringInfo(CE->getOperand(0));
- if (Str) {
- unsigned len = strlen(Str);
+ std::string Str;
+ if (GetConstantStringInfo(CE->getOperand(0), Str) && !Str.empty()) {
+ unsigned len = Str.length();
const Type *Ty = cast<PointerType>(CE->getType())->getElementType();
unsigned numBits = Ty->getPrimitiveSizeInBits();
-
// Replace LI with immediate integer store.
if ((numBits >> 3) == len + 1) {
APInt StrVal(numBits, 0);
OpenPOWER on IntegriCloud