diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp index 33fcd8c4860..2b06d778e14 100644 --- a/lib/Transforms/Utils/Mem2Reg.cpp +++ b/lib/Transforms/Utils/Mem2Reg.cpp @@ -16,7 +16,6 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/PromoteMemToReg.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" -#include "llvm/IntrinsicInst.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Instructions.h" #include "llvm/Function.h" @@ -54,30 +53,6 @@ namespace { char PromotePass::ID = 0; static RegisterPass X("mem2reg", "Promote Memory to Register"); -/// Remove the invalid or redundant debug information. -static void CleanDbgInfo(Function& F) { - std::vector DeadDbgs; - for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) { - if (BBI->size() <= 1) - continue; - for (BasicBlock::iterator I = BBI->begin(), E = BBI->getTerminator(); - I != E; ++I) { - BasicBlock::iterator NextI = I; - ++NextI; - if (isa(I) && isa(NextI)) - DeadDbgs.push_back(I); - else if (isa(I) && isa(NextI)) - DeadDbgs.push_back(I); - } - } - - while (!DeadDbgs.empty()) { - Instruction *Inst = DeadDbgs.back(); - DeadDbgs.pop_back(); - Inst->eraseFromParent(); - } -} - bool PromotePass::runOnFunction(Function &F) { std::vector Allocas; @@ -101,7 +76,6 @@ bool PromotePass::runOnFunction(Function &F) { if (Allocas.empty()) break; PromoteMemToReg(Allocas, DT, DF); - CleanDbgInfo(F); NumPromoted += Allocas.size(); Changed = true; }