[llvm-commits] [llvm] r43103 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Evan Cheng evan.cheng at apple.com
Wed Oct 17 16:51:13 PDT 2007


Author: evancheng
Date: Wed Oct 17 18:51:13 2007
New Revision: 43103

URL: http://llvm.org/viewvc/llvm-project?rev=43103&view=rev
Log:
Reverting r43070 for now. It's causing llc test failures.

Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43103&r1=43102&r2=43103&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 17 18:51:13 2007
@@ -7686,8 +7686,6 @@
           Value *Dest = InsertCastBefore(Instruction::BitCast, CI.getOperand(1), NewPtrTy, CI);
           Value *L = new LoadInst(Src, "tmp", false, Align, &CI);
           Value *NS = new StoreInst(L, Dest, false, Align, &CI);
-          AddToWorkList(cast<Instruction>(L));
-          AddToWorkList(cast<Instruction>(NS));
           CI.replaceAllUsesWith(NS);
           Changed = true;
           return EraseInstFromFunction(CI);
@@ -9116,29 +9114,6 @@
         }
 
       } else if (CE->isCast()) {
-        // Instead of loading constant c string, use corresponding integer value
-        // directly if string length is small enough.
-        const std::string &Str = CE->getOperand(0)->getStringValue();
-        if (!Str.empty()) {
-          unsigned len = Str.length();
-          const Type *Ty = cast<PointerType>(CE->getType())->getElementType();
-          unsigned numBits = Ty->getPrimitiveSizeInBits();
-          if ((numBits >> 3) == len + 1) {
-            // Replace LI with immediate integer store.
-            APInt StrVal(numBits, 0);
-            APInt SingleChar(numBits, 0);
-            for (unsigned i = 0; i < len; i++) {
-              SingleChar = (uint64_t) Str[i];
-              StrVal = (StrVal << 8) | SingleChar;
-            }
-            // Append NULL at the end.
-            SingleChar = 0;
-            StrVal = (StrVal << 8) | SingleChar;
-            Value *NL = ConstantInt::get(StrVal);
-            return ReplaceInstUsesWith(LI, NL);
-          }
-        }
-
         if (Instruction *Res = InstCombineLoadCast(*this, LI))
           return Res;
       }





More information about the llvm-commits mailing list