diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index c35b5c67308..c672c4e5015 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -422,6 +422,7 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { } else if (LoadInst *LI = dyn_cast(I)) { +#if 0 Value *Pointer = LI->getPointerOperand(); // Peephole optimize the following instructions: @@ -444,46 +445,6 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { PRINT_PEEPHOLE1("gep-load:out", LI); return true; } - -#if 0 - // Peephole optimize the following instructions: - // %t1 = cast * %t0 to * - // %V = load * %t1 - // - // Into: %t1 = load * %t0 - // %V = cast %t1 to - // - // The idea behind this transformation is that if the expression type - // conversion engine could not convert the cast into some other nice form, - // that there is something fundementally wrong with the current shape of - // the program. Move the cast through the load and try again. This will - // leave the original cast instruction, to presumably become dead. - // - if (CastInst *CI = dyn_cast(Pointer)) { - Value *SrcVal = CI->getOperand(0); - const PointerType *SrcTy = dyn_cast(SrcVal->getType()); - const Type *ElTy = SrcTy ? SrcTy->getElementType() : 0; - - // Make sure that nothing will be lost in the new cast... - if (!LI->hasIndices() && SrcTy && - ElTy->isLosslesslyConvertableTo(LI->getType())) { - PRINT_PEEPHOLE2("CL-LoadCast:in ", CI, LI); - - string CName = CI->getName(); CI->setName(""); - LoadInst *NLI = new LoadInst(SrcVal, LI->getName()); - LI->setName(""); // Take over the old load's name - - // Insert the load before the old load - BI = BB->getInstList().insert(BI, NLI)+1; - - // Replace the old load with a new cast... - ReplaceInstWithInst(BB->getInstList(), BI, - CI = new CastInst(NLI, LI->getType(), CName)); - PRINT_PEEPHOLE2("CL-LoadCast:out", NLI, CI); - - return true; - } - } #endif } else if (I->getOpcode() == Instruction::Add && isa(I->getOperand(1))) {