From dfca407c795178cd55bc84e3a3975f4ec964a67d Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 19 Nov 2008 19:01:37 +0000 Subject: [PATCH] Do not use separate utility to walk all instructions and remove dead dbg intrinsics. Let instcombiner do this job. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59659 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Transforms/Utils/DbgInfoUtils.h | 28 ------------- lib/Transforms/Utils/DbgInfoUtils.cpp | 60 ---------------------------- 2 files changed, 88 deletions(-) delete mode 100644 include/llvm/Transforms/Utils/DbgInfoUtils.h delete mode 100644 lib/Transforms/Utils/DbgInfoUtils.cpp diff --git a/include/llvm/Transforms/Utils/DbgInfoUtils.h b/include/llvm/Transforms/Utils/DbgInfoUtils.h deleted file mode 100644 index 13f8fa3ef21..00000000000 --- a/include/llvm/Transforms/Utils/DbgInfoUtils.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Transform/Utils/DbgInfoUtils.h - DbgInfo Utils ----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Utility functions to manipulate debugging information. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TRANSFORMS_UTILS_DBGINFO_H -#define LLVM_TRANSFORMS_UTILS_DBGINFO_H -namespace llvm { -class BasicBlock; -class Function; - -/// RemoveDeadDbgIntrinsics - Remove dead dbg intrinsics from this -/// basic block. -void RemoveDeadDbgIntrinsics(BasicBlock &BB); - -/// RemoveDeadDbgIntrinsics - Remove dead dbg intrinsics from this function. -void RemoveDeadDbgIntrinsics(Function &F); - -} // End llvm namespace -#endif diff --git a/lib/Transforms/Utils/DbgInfoUtils.cpp b/lib/Transforms/Utils/DbgInfoUtils.cpp deleted file mode 100644 index 4bd116a6e56..00000000000 --- a/lib/Transforms/Utils/DbgInfoUtils.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===-- DbgInfoUtils.cpp - DbgInfo Utilities -------------------------------==// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Utility functions to manipulate debugging information. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Transforms/Utils/DbgInfoUtils.h" -#include "llvm/IntrinsicInst.h" - -using namespace llvm; - -/// RemoveDeadDbgIntrinsics - Remove dead dbg intrinsics from this -/// basic block. -void llvm::RemoveDeadDbgIntrinsics(BasicBlock &BB) { - BasicBlock::iterator BI = BB.begin(), BE = BB.end(); - if (BI == BE) return; - - Instruction *Prev = BI; ++BI; - while (BI != BE) { - Instruction *Next = BI; ++BI; - DbgInfoIntrinsic *DBI_Prev = dyn_cast(Prev); - if (!DBI_Prev) { - Prev = Next; - continue; - } - - // If there are two consecutive llvm.dbg.stoppoint calls then - // it is likely that the optimizer deleted code in between these - // two intrinsics. - DbgInfoIntrinsic *DBI_Next = dyn_cast(Next); - if (DBI_Next - && DBI_Prev->getIntrinsicID() == llvm::Intrinsic::dbg_stoppoint - && DBI_Next->getIntrinsicID() == llvm::Intrinsic::dbg_stoppoint) - Prev->eraseFromParent(); - - // If a llvm.dbg.stoppoint is placed just before an unconditional - // branch then remove the llvm.dbg.stoppoint intrinsic. - else if (BranchInst *UC = dyn_cast(Next)) { - if (UC->isUnconditional() - && DBI_Prev->getIntrinsicID() == llvm::Intrinsic::dbg_stoppoint) - Prev->eraseFromParent(); - } - - Prev = Next; - } -} - -/// RemoveDeadDbgIntrinsics - Remove dead dbg intrinsics from this function. -void llvm::RemoveDeadDbgIntrinsics(Function &F) { - for (Function::iterator FI = F.begin(), FE = F.end(); - FI != FE; ++FI) - RemoveDeadDbgIntrinsics(*FI); -} -- 2.11.0