Clean up some whitespace and comments. No functionality change.

llvm-svn: 149845
This commit is contained in:
Nick Lewycky 2012-02-05 19:48:37 +00:00
parent b97841e981
commit bbd1156b95
1 changed files with 13 additions and 13 deletions

View File

@ -156,10 +156,10 @@ struct GlobalStatus {
} }
// SafeToDestroyConstant - It is safe to destroy a constant iff it is only used /// SafeToDestroyConstant - It is safe to destroy a constant iff it is only used
// by constants itself. Note that constants cannot be cyclic, so this test is /// by constants itself. Note that constants cannot be cyclic, so this test is
// pretty easy to implement recursively. /// pretty easy to implement recursively.
// ///
static bool SafeToDestroyConstant(const Constant *C) { static bool SafeToDestroyConstant(const Constant *C) {
if (isa<GlobalValue>(C)) return false; if (isa<GlobalValue>(C)) return false;
@ -821,7 +821,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
CallInst *CI, CallInst *CI,
Type *AllocTy, Type *AllocTy,
ConstantInt *NElements, ConstantInt *NElements,
TargetData* TD) { TargetData *TD) {
DEBUG(errs() << "PROMOTING GLOBAL: " << *GV << " CALL = " << *CI << '\n'); DEBUG(errs() << "PROMOTING GLOBAL: " << *GV << " CALL = " << *CI << '\n');
Type *GlobalType; Type *GlobalType;
@ -1265,9 +1265,9 @@ static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Load,
/// PerformHeapAllocSRoA - CI is an allocation of an array of structures. Break /// PerformHeapAllocSRoA - CI is an allocation of an array of structures. Break
/// it up into multiple allocations of arrays of the fields. /// it up into multiple allocations of arrays of the fields.
static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, CallInst *CI, static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, CallInst *CI,
Value* NElems, TargetData *TD) { Value *NElems, TargetData *TD) {
DEBUG(dbgs() << "SROA HEAP ALLOC: " << *GV << " MALLOC = " << *CI << '\n'); DEBUG(dbgs() << "SROA HEAP ALLOC: " << *GV << " MALLOC = " << *CI << '\n');
Type* MAT = getMallocAllocatedType(CI); Type *MAT = getMallocAllocatedType(CI);
StructType *STy = cast<StructType>(MAT); StructType *STy = cast<StructType>(MAT);
// There is guaranteed to be at least one use of the malloc (storing // There is guaranteed to be at least one use of the malloc (storing
@ -1474,7 +1474,7 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV,
// We can't optimize this if the malloc itself is used in a complex way, // We can't optimize this if the malloc itself is used in a complex way,
// for example, being stored into multiple globals. This allows the // for example, being stored into multiple globals. This allows the
// malloc to be stored into the specified global, loaded setcc'd, and // malloc to be stored into the specified global, loaded icmp'd, and
// GEP'd. These are all things we could transform to using the global // GEP'd. These are all things we could transform to using the global
// for. // for.
SmallPtrSet<const PHINode*, 8> PHIs; SmallPtrSet<const PHINode*, 8> PHIs;
@ -1535,7 +1535,7 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV,
extractMallocCallFromBitCast(Malloc) : cast<CallInst>(Malloc); extractMallocCallFromBitCast(Malloc) : cast<CallInst>(Malloc);
} }
GVI = PerformHeapAllocSRoA(GV, CI, getMallocArraySize(CI, TD, true),TD); GVI = PerformHeapAllocSRoA(GV, CI, getMallocArraySize(CI, TD, true), TD);
return true; return true;
} }
@ -1564,7 +1564,7 @@ static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal,
if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC)) if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC))
return true; return true;
} else if (CallInst *CI = extractMallocCall(StoredOnceVal)) { } else if (CallInst *CI = extractMallocCall(StoredOnceVal)) {
Type* MallocType = getMallocAllocatedType(CI); Type *MallocType = getMallocAllocatedType(CI);
if (MallocType && TryToOptimizeStoreOfMallocToGlobal(GV, CI, MallocType, if (MallocType && TryToOptimizeStoreOfMallocToGlobal(GV, CI, MallocType,
GVI, TD)) GVI, TD))
return true; return true;
@ -1727,11 +1727,11 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
GS.AccessingFunction->hasExternalLinkage() && GS.AccessingFunction->hasExternalLinkage() &&
GV->getType()->getAddressSpace() == 0) { GV->getType()->getAddressSpace() == 0) {
DEBUG(dbgs() << "LOCALIZING GLOBAL: " << *GV); DEBUG(dbgs() << "LOCALIZING GLOBAL: " << *GV);
Instruction& FirstI = const_cast<Instruction&>(*GS.AccessingFunction Instruction &FirstI = const_cast<Instruction&>(*GS.AccessingFunction
->getEntryBlock().begin()); ->getEntryBlock().begin());
Type* ElemTy = GV->getType()->getElementType(); Type *ElemTy = GV->getType()->getElementType();
// FIXME: Pass Global's alignment when globals have alignment // FIXME: Pass Global's alignment when globals have alignment
AllocaInst* Alloca = new AllocaInst(ElemTy, NULL, GV->getName(), &FirstI); AllocaInst *Alloca = new AllocaInst(ElemTy, NULL, GV->getName(), &FirstI);
if (!isa<UndefValue>(GV->getInitializer())) if (!isa<UndefValue>(GV->getInitializer()))
new StoreInst(GV->getInitializer(), Alloca, &FirstI); new StoreInst(GV->getInitializer(), Alloca, &FirstI);