Fix various whitespace inconsistencies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2007-05-08 15:19:19 +00:00
parent f742c2363c
commit 1cc0096d55

View File

@ -50,10 +50,10 @@ namespace {
LoopInfo *LI; // The current loop information LoopInfo *LI; // The current loop information
public: public:
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
LoopUnroll() : LoopPass((intptr_t)&ID) {} LoopUnroll() : LoopPass((intptr_t)&ID) {}
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM);
BasicBlock* FoldBlockIntoPredecessor(BasicBlock* BB); BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB);
/// This transformation requires natural loop information & requires that /// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG... /// loop preheaders be inserted into the CFG...
@ -114,7 +114,7 @@ static inline void RemapInstruction(Instruction *I,
// FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it // FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it
// only has one predecessor, and that predecessor only has one successor. // only has one predecessor, and that predecessor only has one successor.
// Returns the new combined block. // Returns the new combined block.
BasicBlock* LoopUnroll::FoldBlockIntoPredecessor(BasicBlock* BB) { BasicBlock *LoopUnroll::FoldBlockIntoPredecessor(BasicBlock *BB) {
// Merge basic blocks into their predecessor if there is only one distinct // Merge basic blocks into their predecessor if there is only one distinct
// pred, and if there is only one distinct successor of the predecessor, and // pred, and if there is only one distinct successor of the predecessor, and
// if there are no PHI nodes. // if there are no PHI nodes.
@ -165,8 +165,8 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
bool Changed = false; bool Changed = false;
LI = &getAnalysis<LoopInfo>(); LI = &getAnalysis<LoopInfo>();
BasicBlock* Header = L->getHeader(); BasicBlock *Header = L->getHeader();
BasicBlock* LatchBlock = L->getLoopLatch(); BasicBlock *LatchBlock = L->getLoopLatch();
BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator()); BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator());
if (BI == 0) return Changed; // Must end in a conditional branch if (BI == 0) return Changed; // Must end in a conditional branch
@ -262,10 +262,10 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
if (*BB != LatchBlock) if (*BB != LatchBlock)
for (Value::use_iterator UI = (*BB)->use_begin(), UE = (*BB)->use_end(); for (Value::use_iterator UI = (*BB)->use_begin(), UE = (*BB)->use_end();
UI != UE; ++UI) { UI != UE; ++UI) {
Instruction* UseInst = cast<Instruction>(*UI); Instruction *UseInst = cast<Instruction>(*UI);
if (isa<PHINode>(UseInst) && !L->contains(UseInst->getParent())) { if (isa<PHINode>(UseInst) && !L->contains(UseInst->getParent())) {
PHINode* phi = cast<PHINode>(UseInst); PHINode *phi = cast<PHINode>(UseInst);
Value* Incoming = phi->getIncomingValueForBlock(*BB); Value *Incoming = phi->getIncomingValueForBlock(*BB);
if (isa<Instruction>(Incoming)) if (isa<Instruction>(Incoming))
Incoming = LastValueMap[Incoming]; Incoming = LastValueMap[Incoming];
@ -298,7 +298,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
SmallPtrSet<PHINode*, 8> Users; SmallPtrSet<PHINode*, 8> Users;
for (Value::use_iterator UI = LatchBlock->use_begin(), for (Value::use_iterator UI = LatchBlock->use_begin(),
UE = LatchBlock->use_end(); UI != UE; ++UI) UE = LatchBlock->use_end(); UI != UE; ++UI)
if (PHINode* phi = dyn_cast<PHINode>(*UI)) if (PHINode *phi = dyn_cast<PHINode>(*UI))
Users.insert(phi); Users.insert(phi);
BasicBlock *LastIterationBB = cast<BasicBlock>(LastValueMap[LatchBlock]); BasicBlock *LastIterationBB = cast<BasicBlock>(LastValueMap[LatchBlock]);
@ -328,7 +328,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
// Insert the branches that link the different iterations together // Insert the branches that link the different iterations together
for (unsigned i = 0; i < Latches.size()-1; ++i) { for (unsigned i = 0; i < Latches.size()-1; ++i) {
new BranchInst(Headers[i+1], Latches[i]); new BranchInst(Headers[i+1], Latches[i]);
if(BasicBlock* Fold = FoldBlockIntoPredecessor(Headers[i+1])) { if (BasicBlock *Fold = FoldBlockIntoPredecessor(Headers[i+1])) {
std::replace(Latches.begin(), Latches.end(), Headers[i+1], Fold); std::replace(Latches.begin(), Latches.end(), Headers[i+1], Fold);
std::replace(Headers.begin(), Headers.end(), Headers[i+1], Fold); std::replace(Headers.begin(), Headers.end(), Headers[i+1], Fold);
} }