Oops...I committed too much.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66867 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2009-03-13 04:39:26 +00:00
parent c7a09ab311
commit 0582ae99ba
14 changed files with 233 additions and 254 deletions

View File

@@ -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);