[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Jeff Cohen jeffc at jolt-lang.org
Sat Jul 30 11:33:39 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.16 -> 1.17
---
Log message:

Keep tabs and trailing spaces out.

---
Diffs of the changes:  (+23 -23)

 LoopStrengthReduce.cpp |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.16 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.17
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.16	Sat Jul 30 13:22:27 2005
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Sat Jul 30 13:33:25 2005
@@ -172,7 +172,7 @@
   if (SCEVUnknown *SU = dyn_cast<SCEVUnknown>(AddRec->getOperand(1)))
     if (SU->getValue()->getType()->isUnsigned())
       return true;
-  
+
   // Otherwise, no, we can't handle it yet.
   return false;
 }
@@ -192,7 +192,7 @@
 
   // This index is scaled by the type size being indexed.
   if (TySize != 1)
-    Result = SCEVMulExpr::get(Result, 
+    Result = SCEVMulExpr::get(Result,
                               SCEVConstant::get(ConstantUInt::get(UIntPtrTy,
                                                                   TySize)));
   return Result;
@@ -216,7 +216,7 @@
   Value *BasePtr;
   if (Constant *CB = dyn_cast<Constant>(GEP->getOperand(0)))
     BasePtr = ConstantExpr::getCast(CB, UIntPtrTy);
-  else { 
+  else {
     Value *&BP = CastedBasePointers[GEP->getOperand(0)];
     if (BP == 0) {
       BasicBlock::iterator InsertPt;
@@ -321,7 +321,7 @@
     DEBUG(std::cerr << "FOUND USER: " << *User
           << "   OF STRIDE: " << *Step << " BASE = " << *Base << "\n");
 
-    
+
     // Okay, we found a user that we cannot reduce.  Analyze the instruction
     // and decide what to do with it.
     IVUsesByStride[Step].addUser(Base, User, GEP);
@@ -351,7 +351,7 @@
   assert(Step->getType()->isUnsigned() && "Bad step value!");
 
   std::set<GetElementPtrInst*> AnalyzedGEPs;
-  
+
   for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;++UI){
     Instruction *User = cast<Instruction>(*UI);
 
@@ -364,12 +364,12 @@
     if (LI->getLoopFor(User->getParent()) != L)
       continue;
 
-    // Next, see if this user is analyzable itself!    
+    // Next, see if this user is analyzable itself!
     if (!AddUsersIfInteresting(User, L)) {
       if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(User)) {
         // If this is a getelementptr instruction, figure out what linear
         // expression of induction variable is actually being used.
-        // 
+        //
         if (AnalyzedGEPs.insert(GEP).second)   // Not already analyzed?
           AnalyzeGetElementPtrUsers(GEP, I, L);
       } else {
@@ -426,12 +426,12 @@
 /// isTargetConstant - Return true if the following can be referenced by the
 /// immediate field of a target instruction.
 static bool isTargetConstant(const SCEVHandle &V) {
-  
+
   // FIXME: Look at the target to decide if &GV is a legal constant immediate.
   if (isa<SCEVConstant>(V)) return true;
-  
+
   return false;     // ENABLE this for x86
-   
+
   if (SCEVUnknown *SU = dyn_cast<SCEVUnknown>(V))
     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(SU->getValue()))
       if (CE->getOpcode() == Instruction::Cast)
@@ -455,7 +455,7 @@
     for (; i != SAE->getNumOperands(); ++i)
       if (isTargetConstant(SAE->getOperand(i))) {
         SCEVHandle ImmVal = SAE->getOperand(i);
-       
+
         // If there are any other immediates that we can handle here, pull them
         // out too.
         for (++i; i != SAE->getNumOperands(); ++i)
@@ -481,8 +481,8 @@
   // eventually emit the object.
   std::vector<std::pair<SCEVHandle, BasedUser> > UsersToProcess;
   UsersToProcess.reserve(Uses.Users.size());
-  
-  SCEVHandle ZeroBase = SCEVUnknown::getIntegerSCEV(0, 
+
+  SCEVHandle ZeroBase = SCEVUnknown::getIntegerSCEV(0,
                                               Uses.Users[0].first->getType());
 
   for (unsigned i = 0, e = Uses.Users.size(); i != e; ++i)
@@ -497,7 +497,7 @@
   for (unsigned i = 0, e = UsersToProcess.size(); i != e; ++i) {
     bool isAddress = isa<LoadInst>(UsersToProcess[i].second.Inst) ||
                      isa<StoreInst>(UsersToProcess[i].second.Inst);
-    UsersToProcess[i].second.Imm = GetImmediateValues(UsersToProcess[i].first, 
+    UsersToProcess[i].second.Imm = GetImmediateValues(UsersToProcess[i].first,
                                                       isAddress);
     UsersToProcess[i].first = SCEV::getMinusSCEV(UsersToProcess[i].first,
                                                  UsersToProcess[i].second.Imm);
@@ -511,14 +511,14 @@
   Instruction *PreInsertPt = Preheader->getTerminator();
   Instruction *PhiInsertBefore = L->getHeader()->begin();
 
-  assert(isa<PHINode>(PhiInsertBefore) && 
+  assert(isa<PHINode>(PhiInsertBefore) &&
          "How could this loop have IV's without any phis?");
   PHINode *SomeLoopPHI = cast<PHINode>(PhiInsertBefore);
   assert(SomeLoopPHI->getNumIncomingValues() == 2 &&
          "This loop isn't canonicalized right");
   BasicBlock *LatchBlock =
    SomeLoopPHI->getIncomingBlock(SomeLoopPHI->getIncomingBlock(0) == Preheader);
-  
+
   // FIXME: This loop needs increasing levels of intelligence.
   // STAGE 0: just emit everything as its own base.  <-- We are here
   // STAGE 1: factor out common vars from bases, and try and push resulting
@@ -534,7 +534,7 @@
     PHINode *NewPHI = new PHINode(ReplacedTy, Replaced->getName()+".str",
                                   PhiInsertBefore);
 
-    // Emit the initial base value into the loop preheader, and add it to the 
+    // Emit the initial base value into the loop preheader, and add it to the
     // Phi node.
     Value *BaseV = Rewriter.expandCodeFor(UsersToProcess.front().first,
                                           PreInsertPt, ReplacedTy);
@@ -552,7 +552,7 @@
 
     // Emit the code to add the immediate offset to the Phi value, just before
     // the instruction that we identified as using this stride and base.
-    // First, empty the SCEVExpander's expression map  so that we are guaranteed 
+    // First, empty the SCEVExpander's expression map  so that we are guaranteed
     // to have the code emitted where we expect it.
     Rewriter.clear();
     SCEVHandle NewValSCEV = SCEVAddExpr::get(SCEVUnknown::get(NewPHI),
@@ -560,16 +560,16 @@
     Value *newVal = Rewriter.expandCodeFor(NewValSCEV,
                                            UsersToProcess.front().second.Inst,
                                            ReplacedTy);
-    
+
     // Replace the use of the operand Value with the new Phi we just created.
-    DEBUG(std::cerr << "REPLACING: " << *Replaced << "IN: " << 
+    DEBUG(std::cerr << "REPLACING: " << *Replaced << "IN: " <<
           *UsersToProcess.front().second.Inst << "WITH: "<< *newVal << '\n');
     UsersToProcess.front().second.Inst->replaceUsesOfWith(Replaced, newVal);
-    
+
     // Mark old value we replaced as possibly dead, so that it is elminated
     // if we just replaced the last use of that value.
     DeadInsts.insert(cast<Instruction>(Replaced));
-    
+
     UsersToProcess.erase(UsersToProcess.begin());
     ++NumReduced;
 
@@ -578,7 +578,7 @@
 
   // IMPORTANT TODO: Figure out how to partition the IV's with this stride, but
   // different starting values, into different PHIs.
-  
+
   // BEFORE writing this, it's probably useful to handle GEP's.
 
   // NOTE: pull all constants together, for REG+IMM addressing, include &GV in






More information about the llvm-commits mailing list