[llvm-commits] [llvm] r40749 - /llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
Owen Anderson
resistor at mac.com
Thu Aug 2 11:11:11 PDT 2007
Author: resistor
Date: Thu Aug 2 13:11:11 2007
New Revision: 40749
URL: http://llvm.org/viewvc/llvm-project?rev=40749&view=rev
Log:
Fix 80 col. violations.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=40749&r1=40748&r2=40749&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Thu Aug 2 13:11:11 2007
@@ -1,4 +1,4 @@
-//===- DeadStoreElimination.cpp - Fast Dead Store Elimination --------------===//
+//===- DeadStoreElimination.cpp - Fast Dead Store Elimination -------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -47,8 +47,9 @@
}
bool runOnBasicBlock(BasicBlock &BB);
- bool handleFreeWithNonTrivialDependency(FreeInst* F, Instruction* dependency,
- SetVector<Instruction*>& possiblyDead);
+ bool handleFreeWithNonTrivialDependency(FreeInst* F,
+ Instruction* dependency,
+ SetVector<Instruction*>& possiblyDead);
bool handleEndBlock(BasicBlock& BB, SetVector<Instruction*>& possiblyDead);
bool RemoveUndeadPointers(Value* pointer, unsigned pointerSize,
BasicBlock::iterator& BBI,
@@ -57,7 +58,8 @@
void DeleteDeadInstructionChains(Instruction *I,
SetVector<Instruction*> &DeadInsts);
void TranslatePointerBitCasts(Value*& v) {
- assert(isa<PointerType>(v->getType()) && "Translating a non-pointer type?");
+ assert(isa<PointerType>(v->getType()) &&
+ "Translating a non-pointer type?");
// See through pointer-to-pointer bitcasts
while (isa<BitCastInst>(v) || isa<GetElementPtrInst>(v))
@@ -95,7 +97,8 @@
bool MadeChange = false;
// Do a top-down walk on the BB
- for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); BBI != BBE; ++BBI) {
+ for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end();
+ BBI != BBE; ++BBI) {
// If we find a store or a free...
if (isa<StoreInst>(BBI) || isa<FreeInst>(BBI)) {
Value* pointer = 0;
@@ -144,7 +147,8 @@
// Handle frees whose dependencies are non-trivial
if (FreeInst* F = dyn_cast<FreeInst>(BBI))
if (!deletedStore)
- MadeChange |= handleFreeWithNonTrivialDependency(F, MD.getDependency(F),
+ MadeChange |= handleFreeWithNonTrivialDependency(F,
+ MD.getDependency(F),
possiblyDead);
// Update our most-recent-store map
@@ -173,7 +177,7 @@
/// handleFreeWithNonTrivialDependency - Handle frees of entire structures whose
/// dependency is a store to a field of that structure
bool DSE::handleFreeWithNonTrivialDependency(FreeInst* F, Instruction* dep,
- SetVector<Instruction*>& possiblyDead) {
+ SetVector<Instruction*>& possiblyDead) {
TargetData &TD = getAnalysis<TargetData>();
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
@@ -187,7 +191,8 @@
return false;
Value* depPointer = dependency->getPointerOperand();
- unsigned depPointerSize = TD.getTypeSize(dependency->getOperand(0)->getType());
+ const Type* depType = dependency->getOperand(0)->getType();
+ unsigned depPointerSize = TD.getTypeSize(depType);
// Check for aliasing
AliasAnalysis::AliasResult A = AA.alias(F->getPointerOperand(), ~0UL,
@@ -211,9 +216,10 @@
return false;
}
-/// handleEndBlock - Remove dead stores to stack-allocated locations in the function
-/// end block
-bool DSE::handleEndBlock(BasicBlock& BB, SetVector<Instruction*>& possiblyDead) {
+/// handleEndBlock - Remove dead stores to stack-allocated locations in the
+/// function end block
+bool DSE::handleEndBlock(BasicBlock& BB,
+ SetVector<Instruction*>& possiblyDead) {
TargetData &TD = getAnalysis<TargetData>();
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
@@ -282,7 +288,8 @@
// Get size information for the alloca
unsigned pointerSize = ~0UL;
if (ConstantInt* C = dyn_cast<ConstantInt>((*I)->getArraySize()))
- pointerSize = C->getZExtValue() * TD.getTypeSize((*I)->getAllocatedType());
+ pointerSize = C->getZExtValue() * \
+ TD.getTypeSize((*I)->getAllocatedType());
// See if the call site touches it
AliasAnalysis::ModRefResult A = AA.getModRefInfo(CallSite::get(BBI),
@@ -326,10 +333,12 @@
// Get size information for the alloca
unsigned pointerSize = ~0UL;
if (ConstantInt* C = dyn_cast<ConstantInt>((*I)->getArraySize()))
- pointerSize = C->getZExtValue() * TD.getTypeSize((*I)->getAllocatedType());
+ pointerSize = C->getZExtValue() * \
+ TD.getTypeSize((*I)->getAllocatedType());
// See if this pointer could alias it
- AliasAnalysis::AliasResult A = AA.alias(*I, pointerSize, killPointer, killPointerSize);
+ AliasAnalysis::AliasResult A = AA.alias(*I, pointerSize,
+ killPointer, killPointerSize);
// If it must-alias and a store, we can delete it
if (isa<StoreInst>(BBI) && A == AliasAnalysis::MustAlias) {
More information about the llvm-commits
mailing list