DCE.cpp (193323) | DCE.cpp (198090) |
---|---|
1//===- DCE.cpp - Code to perform dead code elimination --------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 7 unchanged lines hidden (view full) --- 16// 17//===----------------------------------------------------------------------===// 18 19#define DEBUG_TYPE "dce" 20#include "llvm/Transforms/Scalar.h" 21#include "llvm/Transforms/Utils/Local.h" 22#include "llvm/Instruction.h" 23#include "llvm/Pass.h" | 1//===- DCE.cpp - Code to perform dead code elimination --------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 7 unchanged lines hidden (view full) --- 16// 17//===----------------------------------------------------------------------===// 18 19#define DEBUG_TYPE "dce" 20#include "llvm/Transforms/Scalar.h" 21#include "llvm/Transforms/Utils/Local.h" 22#include "llvm/Instruction.h" 23#include "llvm/Pass.h" |
24#include "llvm/Support/Compiler.h" | |
25#include "llvm/Support/InstIterator.h" 26#include "llvm/ADT/Statistic.h" 27#include <set> 28using namespace llvm; 29 30STATISTIC(DIEEliminated, "Number of insts removed by DIE pass"); 31STATISTIC(DCEEliminated, "Number of insts removed"); 32 33namespace { 34 //===--------------------------------------------------------------------===// 35 // DeadInstElimination pass implementation 36 // | 24#include "llvm/Support/InstIterator.h" 25#include "llvm/ADT/Statistic.h" 26#include <set> 27using namespace llvm; 28 29STATISTIC(DIEEliminated, "Number of insts removed by DIE pass"); 30STATISTIC(DCEEliminated, "Number of insts removed"); 31 32namespace { 33 //===--------------------------------------------------------------------===// 34 // DeadInstElimination pass implementation 35 // |
37 struct VISIBILITY_HIDDEN DeadInstElimination : public BasicBlockPass { | 36 struct DeadInstElimination : public BasicBlockPass { |
38 static char ID; // Pass identification, replacement for typeid 39 DeadInstElimination() : BasicBlockPass(&ID) {} 40 virtual bool runOnBasicBlock(BasicBlock &BB) { 41 bool Changed = false; 42 for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) { 43 Instruction *Inst = DI++; 44 if (isInstructionTriviallyDead(Inst)) { 45 Inst->eraseFromParent(); --- 88 unchanged lines hidden --- | 37 static char ID; // Pass identification, replacement for typeid 38 DeadInstElimination() : BasicBlockPass(&ID) {} 39 virtual bool runOnBasicBlock(BasicBlock &BB) { 40 bool Changed = false; 41 for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) { 42 Instruction *Inst = DI++; 43 if (isInstructionTriviallyDead(Inst)) { 44 Inst->eraseFromParent(); --- 88 unchanged lines hidden --- |