aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp28
-rw-r--r--lib/Transforms/Scalar/BasicBlockPlacement.cpp14
-rw-r--r--lib/Transforms/Scalar/CondPropagate.cpp6
-rw-r--r--lib/Transforms/Scalar/ConstantProp.cpp6
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp44
-rw-r--r--lib/Transforms/Scalar/DCE.cpp10
-rw-r--r--lib/Transforms/Scalar/DeadStoreElimination.cpp12
-rw-r--r--lib/Transforms/Scalar/GCSE.cpp10
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp26
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp270
-rw-r--r--lib/Transforms/Scalar/LICM.cpp52
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp26
-rw-r--r--lib/Transforms/Scalar/LoopUnroll.cpp16
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp18
-rw-r--r--lib/Transforms/Scalar/LowerConstantExprs.cpp46
-rw-r--r--lib/Transforms/Scalar/LowerGC.cpp18
-rw-r--r--lib/Transforms/Scalar/LowerPacked.cpp88
-rw-r--r--lib/Transforms/Scalar/PRE.cpp20
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp10
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp68
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp24
-rw-r--r--lib/Transforms/Scalar/SimplifyCFG.cpp6
-rw-r--r--lib/Transforms/Scalar/TailDuplication.cpp12
-rw-r--r--lib/Transforms/Scalar/TailRecursionElimination.cpp14
24 files changed, 422 insertions, 422 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 089124a87f..a2ca367c45 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -1,14 +1,14 @@
//===- ADCE.cpp - Code to perform aggressive dead code elimination --------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements "aggressive" dead code elimination. ADCE is DCe where
-// values are assumed to be dead until proven otherwise. This is similar to
+// values are assumed to be dead until proven otherwise. This is similar to
// SCCP, except applied to the liveness of values.
//
//===----------------------------------------------------------------------===//
@@ -116,11 +116,11 @@ void ADCE::markBlockAlive(BasicBlock *BB) {
if (It != CDG.end()) {
// Get the blocks that this node is control dependent on...
const PostDominanceFrontier::DomSetType &CDB = It->second;
- for (PostDominanceFrontier::DomSetType::const_iterator I =
+ for (PostDominanceFrontier::DomSetType::const_iterator I =
CDB.begin(), E = CDB.end(); I != E; ++I)
markTerminatorLive(*I); // Mark all their terminators as live
}
-
+
// If this basic block is live, and it ends in an unconditional branch, then
// the branch is alive as well...
if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()))
@@ -162,7 +162,7 @@ TerminatorInst *ADCE::convertToUnconditionalBranch(TerminatorInst *TI) {
// Remove entries from PHI nodes to avoid confusing ourself later...
for (unsigned i = 1, e = TI->getNumSuccessors(); i != e; ++i)
TI->getSuccessor(i)->removePredecessor(BB);
-
+
// Delete the old branch itself...
BB->getInstList().erase(TI);
return NB;
@@ -203,7 +203,7 @@ bool ADCE::doADCE() {
}
// Iterate over all of the instructions in the function, eliminating trivially
- // dead instructions, and marking instructions live that are known to be
+ // dead instructions, and marking instructions live that are known to be
// needed. Perform the walk in depth first order so that we avoid marking any
// instructions live in basic blocks that are unreachable. These blocks will
// be eliminated later, along with the instructions inside.
@@ -338,7 +338,7 @@ bool ADCE::doADCE() {
return MadeChanges;
}
-
+
// If the entry node is dead, insert a new entry node to eliminate the entry
// node as a special case.
@@ -350,7 +350,7 @@ bool ADCE::doADCE() {
AliveBlocks.insert(NewEntry); // This block is always alive!
LiveSet.insert(NewEntry->getTerminator()); // The branch is live
}
-
+
// Loop over all of the alive blocks in the function. If any successor
// blocks are not alive, we adjust the outgoing branches to branch to the
// first live postdominator of the live block, adjusting any PHI nodes in
@@ -360,7 +360,7 @@ bool ADCE::doADCE() {
if (AliveBlocks.count(I)) {
BasicBlock *BB = I;
TerminatorInst *TI = BB->getTerminator();
-
+
// If the terminator instruction is alive, but the block it is contained
// in IS alive, this means that this terminator is a conditional branch on
// a condition that doesn't matter. Make it an unconditional branch to
@@ -392,7 +392,7 @@ bool ADCE::doADCE() {
break;
}
}
- }
+ }
// There is a special case here... if there IS no post-dominator for
// the block we have nowhere to point our branch to. Instead, convert
@@ -411,12 +411,12 @@ bool ADCE::doADCE() {
// branch into an infinite loop into a return instruction!
//
RemoveSuccessor(TI, i);
-
+
// RemoveSuccessor may replace TI... make sure we have a fresh
// pointer.
//
TI = BB->getTerminator();
-
+
// Rescan this successor...
--i;
} else {
@@ -443,7 +443,7 @@ bool ADCE::doADCE() {
int OldIdx = PN->getBasicBlockIndex(LastDead);
assert(OldIdx != -1 &&"LastDead is not a pred of NextAlive!");
Value *InVal = PN->getIncomingValue(OldIdx);
-
+
// Add an incoming value for BB now...
PN->addIncoming(InVal, BB);
}
diff --git a/lib/Transforms/Scalar/BasicBlockPlacement.cpp b/lib/Transforms/Scalar/BasicBlockPlacement.cpp
index ec31bbf87e..c926c561d8 100644
--- a/lib/Transforms/Scalar/BasicBlockPlacement.cpp
+++ b/lib/Transforms/Scalar/BasicBlockPlacement.cpp
@@ -1,10 +1,10 @@
//===-- BasicBlockPlacement.cpp - Basic Block Code Layout optimization ----===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements a very simple profile guided basic block placement
@@ -37,7 +37,7 @@ using namespace llvm;
namespace {
Statistic<> NumMoved("block-placement", "Number of basic blocks moved");
-
+
struct BlockPlacement : public FunctionPass {
virtual bool runOnFunction(Function &F);
@@ -78,11 +78,11 @@ bool BlockPlacement::runOnFunction(Function &F) {
PI = &getAnalysis<ProfileInfo>();
NumMovedBlocks = 0;
- InsertPos = F.begin();
+ InsertPos = F.begin();
// Recursively place all blocks.
PlaceBlocks(F.begin());
-
+
PlacedBlocks.clear();
NumMoved += NumMovedBlocks;
return NumMovedBlocks != 0;
@@ -115,12 +115,12 @@ void BlockPlacement::PlaceBlocks(BasicBlock *BB) {
while (1) {
// Okay, now place any unplaced successors.
succ_iterator SI = succ_begin(BB), E = succ_end(BB);
-
+
// Scan for the first unplaced successor.
for (; SI != E && PlacedBlocks.count(*SI); ++SI)
/*empty*/;
if (SI == E) return; // No more successors to place.
-
+
unsigned MaxExecutionCount = PI->getExecutionCount(*SI);
BasicBlock *MaxSuccessor = *SI;
diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp
index 0e63b51bb7..d3ad5778bb 100644
--- a/lib/Transforms/Scalar/CondPropagate.cpp
+++ b/lib/Transforms/Scalar/CondPropagate.cpp
@@ -1,10 +1,10 @@
//===-- CondPropagate.cpp - Propagate Conditional Expressions -------------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This pass propagates information about conditional expressions through the
@@ -73,7 +73,7 @@ void CondProp::SimplifyBlock(BasicBlock *BB) {
if (BI->isConditional() && isa<PHINode>(BI->getCondition()) &&
cast<PHINode>(BI->getCondition())->getParent() == BB)
SimplifyPredecessors(BI);
-
+
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->getTerminator())) {
if (isa<PHINode>(SI->getCondition()) &&
cast<PHINode>(SI->getCondition())->getParent() == BB)
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index a3fa4a9665..8955aee281 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -1,10 +1,10 @@
//===- ConstantProp.cpp - Code to perform Simple Constant Propagation -----===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements constant propagation and merging:
@@ -66,7 +66,7 @@ bool ConstantPropagation::runOnFunction(Function &F) {
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end();
UI != UE; ++UI)
WorkList.insert(cast<Instruction>(*UI));
-
+
// Replace all of the uses of a variable with uses of the constant.
I->replaceAllUsesWith(C);
diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp
index da8c500e21..f529502da9 100644
--- a/lib/Transforms/Scalar/CorrelatedExprs.cpp
+++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp
@@ -1,10 +1,10 @@
//===- CorrelatedExprs.cpp - Pass to detect and eliminated c.e.'s ---------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// Correlated Expression Elimination propagates information from conditional
@@ -178,7 +178,7 @@ namespace {
// empty - return true if this region has no information known about it.
bool empty() const { return ValueMap.empty(); }
-
+
const RegionInfo &operator=(const RegionInfo &RI) {
ValueMap = RI.ValueMap;
return *this;
@@ -204,7 +204,7 @@ namespace {
if (I != ValueMap.end()) return &I->second;
return 0;
}
-
+
/// removeValueInfo - Remove anything known about V from our records. This
/// works whether or not we know anything about V.
///
@@ -281,7 +281,7 @@ namespace {
bool SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI);
bool SimplifyInstruction(Instruction *Inst, const RegionInfo &RI);
- };
+ };
RegisterOpt<CEE> X("cee", "Correlated Expression Elimination");
}
@@ -299,7 +299,7 @@ bool CEE::runOnFunction(Function &F) {
// blocks.
DS = &getAnalysis<DominatorSet>();
DT = &getAnalysis<DominatorTree>();
-
+
std::set<BasicBlock*> VisitedBlocks;
bool Changed = TransformRegion(&F.getEntryBlock(), VisitedBlocks);
@@ -458,13 +458,13 @@ bool CEE::ForwardCorrelatedEdgeDestination(TerminatorInst *TI, unsigned SuccNo,
for (BasicBlock::iterator I = OldSucc->begin(), E = OldSucc->end(); I!=E; ++I)
if (I->getType() != Type::VoidTy)
NewRI.removeValueInfo(I);
-
+
// Put the newly discovered information into the RegionInfo...
for (BasicBlock::iterator I = OldSucc->begin(), E = OldSucc->end(); I!=E; ++I)
if (PHINode *PN = dyn_cast<PHINode>(I)) {
int OpNum = PN->getBasicBlockIndex(BB);
assert(OpNum != -1 && "PHI doesn't have incoming edge for predecessor!?");
- PropagateEquality(PN, PN->getIncomingValue(OpNum), NewRI);
+ PropagateEquality(PN, PN->getIncomingValue(OpNum), NewRI);
} else if (SetCondInst *SCI = dyn_cast<SetCondInst>(I)) {
Relation::KnownResult Res = getSetCCResult(SCI, NewRI);
if (Res == Relation::Unknown) return false;
@@ -472,7 +472,7 @@ bool CEE::ForwardCorrelatedEdgeDestination(TerminatorInst *TI, unsigned SuccNo,
} else {
assert(isa<BranchInst>(*I) && "Unexpected instruction type!");
}
-
+
// Compute the facts implied by what we have discovered...
ComputeReplacements(NewRI);
@@ -486,7 +486,7 @@ bool CEE::ForwardCorrelatedEdgeDestination(TerminatorInst *TI, unsigned SuccNo,
ForwardSuccessorTo(TI, SuccNo, BI->getSuccessor(!CB->getValue()), NewRI);
return true;
}
-
+
return false;
}
@@ -582,7 +582,7 @@ void CEE::ForwardSuccessorTo(TerminatorInst *TI, unsigned SuccNo,
// node yet though if this is the last edge into it.
Value *EdgeValue = PN->removeIncomingValue(BB, false);
- // Make sure that anything that used to use PN now refers to EdgeValue
+ // Make sure that anything that used to use PN now refers to EdgeValue
ReplaceUsesOfValueInRegion(PN, EdgeValue, Dest);
// If there is only one value left coming into the PHI node, replace the PHI
@@ -603,7 +603,7 @@ void CEE::ForwardSuccessorTo(TerminatorInst *TI, unsigned SuccNo,
++I; // Otherwise, move on to the next PHI node
}
}
-
+
// Actually revector the branch now...
TI->setSuccessor(SuccNo, Dest);
@@ -689,7 +689,7 @@ static void CalcRegionExitBlocks(BasicBlock *Header, BasicBlock *BB,
} else {
// Header does not dominate this block, but we have a predecessor that does
// dominate us. Add ourself to the list.
- RegionExitBlocks.push_back(BB);
+ RegionExitBlocks.push_back(BB);
}
}
@@ -703,7 +703,7 @@ void CEE::CalculateRegionExitBlocks(BasicBlock *BB, BasicBlock *OldSucc,
// Recursively calculate blocks we are interested in...
CalcRegionExitBlocks(BB, BB, Visited, *DS, RegionExitBlocks);
-
+
// Filter out blocks that are not dominated by OldSucc...
for (unsigned i = 0; i != RegionExitBlocks.size(); ) {
if (DS->dominates(OldSucc, RegionExitBlocks[i]))
@@ -738,7 +738,7 @@ void CEE::InsertRegionExitMerges(PHINode *BBVal, Instruction *OldVal,
// otherwise use OldVal.
NewPN->addIncoming(DS->dominates(BB, *PI) ? BBVal : OldVal, *PI);
}
-
+
// Now make everyone dominated by this block use this new value!
ReplaceUsesOfValueInRegion(OldVal, NewPN, FBlock);
}
@@ -783,7 +783,7 @@ void CEE::PropagateBranchInfo(BranchInst *BI) {
//
PropagateEquality(BI->getCondition(), ConstantBool::True,
getRegionInfo(BI->getSuccessor(0)));
-
+
// Propagate information into the false block...
//
PropagateEquality(BI->getCondition(), ConstantBool::False,
@@ -825,7 +825,7 @@ void CEE::PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
PropagateEquality(Inst->getOperand(0), CB, RI);
PropagateEquality(Inst->getOperand(1), CB, RI);
}
-
+
// If we know that this instruction is an OR instruction, and the result
// is false, this means that both operands to the OR are know to be false
// as well.
@@ -834,7 +834,7 @@ void CEE::PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
PropagateEquality(Inst->getOperand(0), CB, RI);
PropagateEquality(Inst->getOperand(1), CB, RI);
}
-
+
// If we know that this instruction is a NOT instruction, we know that the
// operand is known to be the inverse of whatever the current value is.
//
@@ -857,7 +857,7 @@ void CEE::PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
} else { // If we know the condition is false...
// We know the opposite of the condition is true...
Instruction::BinaryOps C = SCI->getInverseCondition();
-
+
PropagateRelation(C, SCI->getOperand(0), SCI->getOperand(1), RI);
PropagateRelation(SetCondInst::getSwappedCondition(C),
SCI->getOperand(1), SCI->getOperand(0), RI);
@@ -1065,7 +1065,7 @@ Relation::KnownResult CEE::getSetCCResult(SetCondInst *SCI,
const RegionInfo &RI) {
Value *Op0 = SCI->getOperand(0), *Op1 = SCI->getOperand(1);
Instruction::BinaryOps Opcode = SCI->getOpcode();
-
+
if (isa<Constant>(Op0)) {
if (isa<Constant>(Op1)) {
if (Constant *Result = ConstantFoldInstruction(SCI)) {
@@ -1098,7 +1098,7 @@ Relation::KnownResult CEE::getSetCCResult(SetCondInst *SCI,
// If the intersection of the two ranges is empty, then the condition
// could never be true!
- //
+ //
if (Int.isEmptySet()) {
Result = Relation::KnownFalse;
@@ -1254,7 +1254,7 @@ Relation::getImpliedResult(Instruction::BinaryOps Op) const {
// print - Implement the standard print form to print out analysis information.
void CEE::print(std::ostream &O, const Module *M) const {
O << "\nPrinting Correlated Expression Info:\n";
- for (std::map<BasicBlock*, RegionInfo>::const_iterator I =
+ for (std::map<BasicBlock*, RegionInfo>::const_iterator I =
RegionInfoMap.begin(), E = RegionInfoMap.end(); I != E; ++I)
I->second.print(O);
}
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index ae61208b52..759180a371 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -1,10 +1,10 @@
//===- DCE.cpp - Code to perform dead code elimination --------------------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements dead inst elimination and dead code elimination.
@@ -49,7 +49,7 @@ namespace {
AU.setPreservesCFG();
}
};
-
+
RegisterOpt<DeadInstElimination> X("die", "Dead Instruction Elimination");
}
@@ -81,7 +81,7 @@ bool DCE::runOnFunction(Function &F) {
WorkList.push_back(&*i);
}
std::set<Instruction*> DeadInsts;
-
+
// Loop over the worklist finding instructions that are dead. If they are
// dead make them drop all of their uses, making other instructions
// potentially dead, and work until the worklist is empty.
@@ -89,7 +89,7 @@ bool DCE::runOnFunction(Function &F) {
while (!WorkList.empty()) {
Instruction *I = WorkList.back();
WorkList.pop_back();
-
+
if (isInstructionTriviallyDead(I)) { // If the instruction is dead...
// Loop over all of the values that the instruction uses, if there are
// instructions being used, add them to the worklist, because they might
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp
index a823e14c0d..07d5c65520 100644
--- a/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1,10 +1,10 @@
//===- DeadStoreElimination.cpp - Dead Store Elimination ------------------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements a trivial dead store elimination that only considers
@@ -39,9 +39,9 @@ namespace {
Changed |= runOnBasicBlock(*I);
return Changed;
}
-
+
bool runOnBasicBlock(BasicBlock &BB);
-
+
void DeleteDeadInstructionChains(Instruction *I,
SetVector<Instruction*> &DeadInsts);
@@ -87,7 +87,7 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
bool MadeChange = false;
for (BasicBlock::iterator BBI = BB.end(); BBI != BB.begin(); ) {
Instruction *I = --BBI; // Keep moving iterator backwards
-
+
// If this is a free instruction, it makes the free'd location dead!
if (FreeInst *FI = dyn_cast<FreeInst>(I)) {
// Free instructions make any stores to the free'd location dead.
@@ -161,7 +161,7 @@ void DSE::DeleteDeadInstructionChains(Instruction *I,
DeadInsts.insert(Op); // Attempt to nuke it later.
I->setOperand(i, 0); // Drop from the operand list.
}
-
+
I->eraseFromParent();
++NumOther;
}
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index dbabe2686b..a785685b2c 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -1,10 +1,10 @@
//===-- GCSE.cpp - SSA-based Global Common Subexpression Elimination ------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This pass is designed to be a very quick global transformation that
@@ -116,7 +116,7 @@ bool GCSE::runOnFunction(Function &F) {
else {
I = Inst; --I;
}
-
+
// First check to see if we were able to value number this instruction
// to a non-instruction value. If so, prefer that value over other
// instructions which may compute the same thing.
@@ -186,14 +186,14 @@ void GCSE::ReplaceInstructionWith(Instruction *I, Value *V) {
getAnalysis<ValueNumbering>().deleteValue(I);
I->replaceAllUsesWith(V);
-
+
if (InvokeInst *II = dyn_cast<InvokeInst>(I)) {
// Removing an invoke instruction requires adding a branch to the normal
// destination and removing PHI node entries in the exception destination.
new BranchInst(II->getNormalDest(), II);
II->getUnwindDest()->removePredecessor(II->getParent());
}
-
+
// Erase the instruction from the program.
I->getParent()->getInstList().erase(I);
}
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index aabc96c8f2..88ad6d206a 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1,10 +1,10 @@
//===- IndVarSimplify.cpp - Induction Variable Elimination ----------------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This transformation analyzes and transforms the induction variables (and
@@ -76,7 +76,7 @@ namespace {
bool isInsertedInstruction(Instruction *I) const {
return InsertedInstructions.count(I);
}
-
+
/// getOrInsertCanonicalInductionVariable - This method returns the
/// canonical induction variable of the specified type for the specified
/// loop (inserting one if there is none). A canonical induction variable
@@ -128,7 +128,7 @@ namespace {
return ConstantExpr::getCast(C, Ty);
else if (Instruction *I = dyn_cast<Instruction>(V)) {
// Check to see if there is already a cast. If there is, use it.
- for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
+ for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
UI != E; ++UI) {
if ((*UI)->getType() == Ty)
if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(*UI))) {
@@ -206,10 +206,10 @@ Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) {
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getOperand(0)))
if (SC->getValue()->isAllOnesValue())
FirstOp = 1;
-
+
int i = S->getNumOperands()-2;
Value *V = expandInTy(S->getOperand(i+1), Ty);
-
+
// Emit a bunch of multiply instructions
for (; i >= FirstOp; --i)
V = BinaryOperator::createMul(V, expandInTy(S->getOperand(i), Ty),
@@ -358,7 +358,7 @@ DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts) {
/// EliminatePointerRecurrence - Check to see if this is a trivial GEP pointer
/// recurrence. If so, change it into an integer recurrence, permitting
/// analysis by the SCEV routines.
-void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
+void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
BasicBlock *Preheader,
std::set<Instruction*> &DeadInsts) {
assert(PN->getNumIncomingValues() == 2 && "Noncanonicalized loop!");
@@ -368,7 +368,7 @@ void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
dyn_cast<GetElementPtrInst>(PN->getIncomingValue(BackedgeIdx)))
if (GEPI->getOperand(0) == PN) {
assert(GEPI->getNumOperands() == 2 && "GEP types must mismatch!");
-
+
// Okay, we found a pointer recurrence. Transform this pointer
// recurrence into an integer recurrence. Compute the value that gets
// added to the pointer at every iteration.
@@ -383,10 +383,10 @@ void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
Value *NewAdd = BinaryOperator::createAdd(NewPhi, AddedVal,
GEPI->getName()+".rec", GEPI);
NewPhi->addIncoming(NewAdd, PN->getIncomingBlock(BackedgeIdx));
-
+
// Update the existing GEP to use the recurrence.
GEPI->setOperand(0, PN->getIncomingValue(PreheaderIdx));
-
+
// Update the GEP to use the new recurrence we just inserted.
GEPI->setOperand(1, NewAdd);
@@ -547,7 +547,7 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
bool HasConstantItCount = isa<SCEVConstant>(SE->getIterationCount(L));
std::set<Instruction*> InstructionsToDelete;
-
+
for (unsigned i = 0, e = L->getBlocks().size(); i != e; ++i)
if (LI->getLoopFor(L->getBlocks()[i]) == L) { // Not in a subloop...
BasicBlock *BB = L->getBlocks()[i];
@@ -599,7 +599,7 @@ void IndVarSimplify::runOnLoop(Loop *L) {
//
BasicBlock *Header = L->getHeader();
BasicBlock *Preheader = L->getLoopPreheader();
-
+
std::set<Instruction*> DeadInsts;
for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
PHINode *PN = cast<PHINode>(I);
@@ -748,7 +748,7 @@ void IndVarSimplify::runOnLoop(Loop *L) {
DeadInsts.insert(I);
++NumRemoved;
Changed = true;
- }
+ }
}
}
#endif
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index fcdd73d0a6..5a2e4ef177 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -1,10 +1,10 @@
//===- InstructionCombining.cpp - Combine multiple instructions -----------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// InstructionCombining - Combine instructions to form fewer, simple
@@ -103,7 +103,7 @@ namespace {
// null - No change was made
// I - Change was made, I is still valid, I may be dead though
// otherwise - Change was made, replace I with returned instruction
- //
+ //
Instruction *visitAdd(BinaryOperator &I);
Instruction *visitSub(BinaryOperator &I);
Instruction *visitMul(BinaryOperator &I);
@@ -159,7 +159,7 @@ namespace {
/// cast.
Value *InsertCastBefore(Value *V, const Type *Ty, Instruction &Pos) {
if (V->getType() == Ty) return V;
-
+
Instruction *C = new CastInst(V, Ty, V->getName(), &Pos);
WorkList.push_back(C);
return C;
@@ -275,7 +275,7 @@ bool InstCombiner::SimplifyCommutative(BinaryOperator &I) {
bool Changed = false;
if (getComplexity(I.getOperand(0)) < getComplexity(I.getOperand(1)))
Changed = !I.swapOperands();
-
+
if (!I.isAssociative()) return Changed;
Instruction::BinaryOps Opcode = I.getOpcode();
if (BinaryOperator *Op = dyn_cast<BinaryOperator>(I.getOperand(0)))
@@ -302,7 +302,7 @@ bool InstCombiner::SimplifyCommutative(BinaryOperator &I) {
I.setOperand(0, New);
I.setOperand(1, Folded);
return true;
- }
+ }
}
return Changed;
}
@@ -427,7 +427,7 @@ Instruction *AssociativeOpt(BinaryOperator &Root, const Functor &F) {
// reassociate the expression from ((? op A) op B) to (? op (A op B))
if (ShouldApply) {
BasicBlock *BB = Root.getParent();
-
+
// Now all of the instructions are in the current basic block, go ahead
// and perform the reassociation.
Instruction *TmpLHSI = cast<Instruction>(Root.getOperand(0));
@@ -463,12 +463,12 @@ Instruction *AssociativeOpt(BinaryOperator &Root, const Functor &F) {
TmpLHSI = NextLHSI;
ExtraOperand = NextOp;
}
-
+
// Now that the instructions