Rename FastDSE to just DSE.

llvm-svn: 40668
This commit is contained in:
Owen Anderson 2007-08-01 06:36:51 +00:00
parent 45499c55e5
commit 58e64df595
10 changed files with 19 additions and 27 deletions

View File

@ -62,7 +62,6 @@ namespace {
(void) llvm::createDeadTypeEliminationPass(); (void) llvm::createDeadTypeEliminationPass();
(void) llvm::createEdgeProfilerPass(); (void) llvm::createEdgeProfilerPass();
(void) llvm::createRedundantLoadEliminationPass(); (void) llvm::createRedundantLoadEliminationPass();
(void) llvm::createFastDeadStoreEliminationPass();
(void) llvm::createFunctionInliningPass(); (void) llvm::createFunctionInliningPass();
(void) llvm::createFunctionProfilerPass(); (void) llvm::createFunctionProfilerPass();
(void) llvm::createGCSEPass(); (void) llvm::createGCSEPass();

View File

@ -323,13 +323,6 @@ FunctionPass *createPredicateSimplifierPass();
// //
FunctionPass *createGVNPREPass(); FunctionPass *createGVNPREPass();
//===----------------------------------------------------------------------===//
//
// FastDeadStoreElimination - This pass deletes stores that are post-dominated by
// must-aliased stores and are not loaded used between the stores.
//
FunctionPass *createFastDeadStoreEliminationPass();
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// RedundantLoadElimination - This pass deletes loads that are dominated by // RedundantLoadElimination - This pass deletes loads that are dominated by

View File

@ -1,4 +1,4 @@
//===- FastDSE.cpp - Fast Dead Store Elimination --------------------------===// //===- DeadStoreElimination.cpp - Fast Dead Store Elimination --------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -15,7 +15,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "fdse" #define DEBUG_TYPE "dse"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/Function.h" #include "llvm/Function.h"
@ -35,9 +35,9 @@ STATISTIC(NumFastStores, "Number of stores deleted");
STATISTIC(NumFastOther , "Number of other instrs removed"); STATISTIC(NumFastOther , "Number of other instrs removed");
namespace { namespace {
struct VISIBILITY_HIDDEN FDSE : public FunctionPass { struct VISIBILITY_HIDDEN DSE : public FunctionPass {
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
FDSE() : FunctionPass((intptr_t)&ID) {} DSE() : FunctionPass((intptr_t)&ID) {}
virtual bool runOnFunction(Function &F) { virtual bool runOnFunction(Function &F) {
bool Changed = false; bool Changed = false;
@ -78,13 +78,13 @@ namespace {
AU.addPreserved<MemoryDependenceAnalysis>(); AU.addPreserved<MemoryDependenceAnalysis>();
} }
}; };
char FDSE::ID = 0; char DSE::ID = 0;
RegisterPass<FDSE> X("fdse", "Fast Dead Store Elimination"); RegisterPass<DSE> X("dse", "Dead Store Elimination");
} }
FunctionPass *llvm::createFastDeadStoreEliminationPass() { return new FDSE(); } FunctionPass *llvm::createDeadStoreEliminationPass() { return new DSE(); }
bool FDSE::runOnBasicBlock(BasicBlock &BB) { bool DSE::runOnBasicBlock(BasicBlock &BB) {
MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>(); MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
// Record the last-seen store to this pointer // Record the last-seen store to this pointer
@ -172,7 +172,7 @@ bool FDSE::runOnBasicBlock(BasicBlock &BB) {
/// handleFreeWithNonTrivialDependency - Handle frees of entire structures whose /// handleFreeWithNonTrivialDependency - Handle frees of entire structures whose
/// dependency is a store to a field of that structure /// dependency is a store to a field of that structure
bool FDSE::handleFreeWithNonTrivialDependency(FreeInst* F, Instruction* dep, bool DSE::handleFreeWithNonTrivialDependency(FreeInst* F, Instruction* dep,
SetVector<Instruction*>& possiblyDead) { SetVector<Instruction*>& possiblyDead) {
TargetData &TD = getAnalysis<TargetData>(); TargetData &TD = getAnalysis<TargetData>();
AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
@ -213,7 +213,7 @@ bool FDSE::handleFreeWithNonTrivialDependency(FreeInst* F, Instruction* dep,
/// handleEndBlock - Remove dead stores to stack-allocated locations in the function /// handleEndBlock - Remove dead stores to stack-allocated locations in the function
/// end block /// end block
bool FDSE::handleEndBlock(BasicBlock& BB, SetVector<Instruction*>& possiblyDead) { bool DSE::handleEndBlock(BasicBlock& BB, SetVector<Instruction*>& possiblyDead) {
TargetData &TD = getAnalysis<TargetData>(); TargetData &TD = getAnalysis<TargetData>();
AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>(); MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
@ -309,7 +309,7 @@ bool FDSE::handleEndBlock(BasicBlock& BB, SetVector<Instruction*>& possiblyDead)
return MadeChange; return MadeChange;
} }
bool FDSE::RemoveUndeadPointers(Value* killPointer, unsigned killPointerSize, bool DSE::RemoveUndeadPointers(Value* killPointer, unsigned killPointerSize,
BasicBlock::iterator& BBI, BasicBlock::iterator& BBI,
SmallPtrSet<AllocaInst*, 4>& deadPointers, SmallPtrSet<AllocaInst*, 4>& deadPointers,
SetVector<Instruction*>& possiblyDead) { SetVector<Instruction*>& possiblyDead) {
@ -363,7 +363,7 @@ bool FDSE::RemoveUndeadPointers(Value* killPointer, unsigned killPointerSize,
return MadeChange; return MadeChange;
} }
void FDSE::DeleteDeadInstructionChains(Instruction *I, void DSE::DeleteDeadInstructionChains(Instruction *I,
SetVector<Instruction*> &DeadInsts) { SetVector<Instruction*> &DeadInsts) {
// Instruction must be dead. // Instruction must be dead.
if (!I->use_empty() || !isInstructionTriviallyDead(I)) return; if (!I->use_empty() || !isInstructionTriviallyDead(I)) return;

View File

@ -1,4 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -fdse -scalarrepl -instcombine | \ ; RUN: llvm-upgrade < %s | llvm-as | opt -dse -scalarrepl -instcombine | \
; RUN: llvm-dis | not grep {ret int undef} ; RUN: llvm-dis | not grep {ret int undef}
int %test(double %__x) { int %test(double %__x) {

View File

@ -1,4 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -fdse | llvm-dis | \ ; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | \
; RUN: grep {store i32 1234567} ; RUN: grep {store i32 1234567}
; Do not delete stores that are only partially killed. ; Do not delete stores that are only partially killed.

View File

@ -1,4 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -fdse | llvm-dis | grep store ; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | grep store
double %foo(sbyte* %X) { double %foo(sbyte* %X) {
%X_addr = alloca sbyte* %X_addr = alloca sbyte*

View File

@ -1,4 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -fdse -disable-output ; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -dse -disable-output
target endian = big target endian = big
target pointersize = 32 target pointersize = 32
target triple = "powerpc-apple-darwin8" target triple = "powerpc-apple-darwin8"

View File

@ -1,4 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -fdse | llvm-dis | \ ; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | \
; RUN: not grep {store sbyte} ; RUN: not grep {store sbyte}
; Ensure that the dead store is deleted in this case. It is wholely ; Ensure that the dead store is deleted in this case. It is wholely
; overwritten by the second store. ; overwritten by the second store.

View File

@ -168,7 +168,7 @@ void Optimize(Module* M) {
addPass(Passes, createLICMPass()); // Hoist loop invariants addPass(Passes, createLICMPass()); // Hoist loop invariants
addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs
addPass(Passes, createGCSEPass()); // Remove common subexprs addPass(Passes, createGCSEPass()); // Remove common subexprs
addPass(Passes, createFastDeadStoreEliminationPass()); // Nuke dead stores addPass(Passes, createDeadStoreEliminationPass()); // Nuke dead stores
// Cleanup and simplify the code after the scalar optimizations. // Cleanup and simplify the code after the scalar optimizations.
addPass(Passes, createInstructionCombiningPass()); addPass(Passes, createInstructionCombiningPass());

View File

@ -290,7 +290,7 @@ void AddStandardCompilePasses(PassManager &PM) {
addPass(PM, createInstructionCombiningPass()); addPass(PM, createInstructionCombiningPass());
addPass(PM, createCondPropagationPass()); // Propagate conditionals addPass(PM, createCondPropagationPass()); // Propagate conditionals
addPass(PM, createFastDeadStoreEliminationPass()); // Delete dead stores addPass(PM, createDeadStoreEliminationPass()); // Delete dead stores
addPass(PM, createAggressiveDCEPass()); // SSA based 'Aggressive DCE' addPass(PM, createAggressiveDCEPass()); // SSA based 'Aggressive DCE'
addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs
addPass(PM, createSimplifyLibCallsPass()); // Library Call Optimizations addPass(PM, createSimplifyLibCallsPass()); // Library Call Optimizations