[llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp InstructionCombining.cpp LoopStrengthReduce.cpp LoopUnroll.cpp LoopUnswitch.cpp SCCP.cpp ScalarReplAggregates.cpp TailRecursionElimination.cpp

Reid Spencer reid at x10sys.com
Thu Nov 2 12:27:01 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

CorrelatedExprs.cpp updated: 1.36 -> 1.37
InstructionCombining.cpp updated: 1.534 -> 1.535
LoopStrengthReduce.cpp updated: 1.92 -> 1.93
LoopUnroll.cpp updated: 1.29 -> 1.30
LoopUnswitch.cpp updated: 1.48 -> 1.49
SCCP.cpp updated: 1.135 -> 1.136
ScalarReplAggregates.cpp updated: 1.46 -> 1.47
TailRecursionElimination.cpp updated: 1.24 -> 1.25
---
Log message:

For PR786: http://llvm.org/PR786 :
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining 
issues when they see them. All changes pass DejaGnu tests and Olden.


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

 CorrelatedExprs.cpp          |    1 -
 InstructionCombining.cpp     |   16 ++++++----------
 LoopStrengthReduce.cpp       |    2 +-
 LoopUnroll.cpp               |    3 +--
 LoopUnswitch.cpp             |    7 ++-----
 SCCP.cpp                     |    4 ++--
 ScalarReplAggregates.cpp     |    2 +-
 TailRecursionElimination.cpp |    1 -
 8 files changed, 13 insertions(+), 23 deletions(-)


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.36 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.37
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.36	Sat Oct 28 01:38:14 2006
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp	Thu Nov  2 14:25:50 2006
@@ -726,7 +726,6 @@
                              const std::vector<BasicBlock*> &RegionExitBlocks) {
   assert(BBVal->getType() == OldVal->getType() && "Should be derived values!");
   BasicBlock *BB = BBVal->getParent();
-  BasicBlock *OldSucc = OldVal->getParent();
 
   // Loop over all of the blocks we have to place PHIs in, doing it.
   for (unsigned i = 0, e = RegionExitBlocks.size(); i != e; ++i) {


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.534 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.535
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.534	Wed Nov  1 19:53:58 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Nov  2 14:25:50 2006
@@ -2579,8 +2579,6 @@
 }
 
 Instruction *InstCombiner::visitFRem(BinaryOperator &I) {
-  Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
-
   return commonRemTransforms(I);
 }
 
@@ -3109,7 +3107,6 @@
   
   {
     Value *A = 0, *B = 0;
-    ConstantInt *C1 = 0, *C2 = 0;
     if (match(Op0, m_Or(m_Value(A), m_Value(B))))
       if (A == Op1 || B == Op1)    // (A | ?) & A  --> A
         return ReplaceInstUsesWith(I, Op1);
@@ -5510,7 +5507,7 @@
       // If the first operand is itself a cast, and is eliminable, do not count
       // this as an eliminable cast.  We would prefer to eliminate those two
       // casts first.
-      if (CastInst *OpCast = dyn_cast<CastInst>(I->getOperand(0)))
+      if (isa<CastInst>(I->getOperand(0)))
         return true;
       
       ++NumCastsRemoved;
@@ -6192,7 +6189,6 @@
   if (Instruction *TI = dyn_cast<Instruction>(TrueVal))
     if (Instruction *FI = dyn_cast<Instruction>(FalseVal))
       if (TI->hasOneUse() && FI->hasOneUse()) {
-        bool isInverse = false;
         Instruction *AddOp = 0, *SubOp = 0;
 
         // Turn (select C, (op X, Y), (op X, Z)) -> (op X, (select C, Y, Z))
@@ -6971,7 +6967,7 @@
   // Insert and return the new operation.
   if (isa<CastInst>(FirstInst))
     return new CastInst(PhiVal, PN.getType());
-  else if (LoadInst *LI = dyn_cast<LoadInst>(FirstInst))
+  else if (isa<LoadInst>(FirstInst))
     return new LoadInst(PhiVal, "", isVolatile);
   else if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(FirstInst))
     return BinaryOperator::create(BinOp->getOpcode(), PhiVal, ConstantOp);
@@ -7327,7 +7323,7 @@
         // If the index will be to exactly the right offset with the scale taken
         // out, perform the transformation.
         if (Scale && Scale->getZExtValue() % ArrayEltSize == 0) {
-          if (ConstantInt *C = dyn_cast<ConstantInt>(Scale))
+          if (isa<ConstantInt>(Scale))
             Scale = ConstantInt::get(Scale->getType(),
                                       Scale->getZExtValue() / ArrayEltSize);
           if (Scale->getZExtValue() != 1) {
@@ -7501,7 +7497,7 @@
   Value *Op = LI.getOperand(0);
 
   // load (cast X) --> cast (load X) iff safe
-  if (CastInst *CI = dyn_cast<CastInst>(Op))
+  if (isa<CastInst>(Op))
     if (Instruction *Res = InstCombineLoadCast(*this, LI))
       return Res;
 
@@ -7728,7 +7724,7 @@
 
   // If the pointer destination is a cast, see if we can fold the cast into the
   // source instead.
-  if (CastInst *CI = dyn_cast<CastInst>(Ptr))
+  if (isa<CastInst>(Ptr))
     if (Instruction *Res = InstCombineStoreToCast(*this, SI))
       return Res;
   if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr))
@@ -8015,7 +8011,7 @@
           InsertNewInstBefore(newEI1, EI);
           return BinaryOperator::create(BO->getOpcode(), newEI0, newEI1);
         }
-      } else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
+      } else if (isa<LoadInst>(I)) {
         Value *Ptr = InsertCastBefore(I->getOperand(0),
                                       PointerType::get(EI.getType()), EI);
         GetElementPtrInst *GEP = 


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.92 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.93
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.92	Sat Oct 28 01:45:33 2006
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Thu Nov  2 14:25:50 2006
@@ -307,7 +307,7 @@
         Start = SCEVAddExpr::get(Start, AE->getOperand(i));
       }
         
-  } else if (SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(SH)) {
+  } else if (isa<SCEVAddRecExpr>(SH)) {
     TheAddRec = SH;
   } else {
     return false;  // not analyzable.


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.29 llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.30
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.29	Fri Oct 20 02:07:24 2006
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp	Thu Nov  2 14:25:50 2006
@@ -92,7 +92,7 @@
         // Ignore PHI nodes in the header.
       } else if (I->hasOneUse() && I->use_back() == Term) {
         // Ignore instructions only used by the loop terminator.
-      } else if (DbgInfoIntrinsic *DbgI = dyn_cast<DbgInfoIntrinsic>(I)) {
+      } else if (isa<DbgInfoIntrinsic>(I)) {
         // Ignore debug instructions
       } else {
         ++Size;
@@ -135,7 +135,6 @@
     return 0;
 
   DEBUG(std::cerr << "Merging: " << *BB << "into: " << *OnlyPred);
-  TerminatorInst *Term = OnlyPred->getTerminator();
 
   // Resolve any PHI nodes at the start of the block.  They are all
   // guaranteed to have exactly one entry if they exist, unless there are


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.48 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.49
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.48	Thu Sep 28 18:35:21 2006
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp	Thu Nov  2 14:25:50 2006
@@ -576,8 +576,6 @@
 
   // Split all of the edges from inside the loop to their exit blocks.  Update
   // the appropriate Phi nodes as we do so.
-  unsigned NumBlocks = L->getBlocks().size();
-  
   for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
     BasicBlock *ExitBlock = ExitBlocks[i];
     std::vector<BasicBlock*> Preds(pred_begin(ExitBlock), pred_end(ExitBlock));
@@ -966,9 +964,8 @@
               BasicBlock* Split = SplitBlock(Old, SI);
               
               Instruction* OldTerm = Old->getTerminator();
-              BranchInst* Branch = new BranchInst(Split, SI->getSuccessor(i),
-                                                  ConstantBool::getTrue(),
-                                                  OldTerm);
+              new BranchInst(Split, SI->getSuccessor(i),
+                             ConstantBool::getTrue(), OldTerm);
               
               Old->getTerminator()->eraseFromParent();
               


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.135 llvm/lib/Transforms/Scalar/SCCP.cpp:1.136
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.135	Mon Oct 23 13:57:02 2006
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Thu Nov  2 14:25:50 2006
@@ -377,7 +377,7 @@
         Succs[BCValue.getConstant() == ConstantBool::getFalse()] = true;
       }
     }
-  } else if (InvokeInst *II = dyn_cast<InvokeInst>(&TI)) {
+  } else if (isa<InvokeInst>(&TI)) {
     // Invoke instructions successors are always executable.
     Succs[0] = Succs[1] = true;
   } else if (SwitchInst *SI = dyn_cast<SwitchInst>(&TI)) {
@@ -436,7 +436,7 @@
       }
       return false;
     }
-  } else if (InvokeInst *II = dyn_cast<InvokeInst>(TI)) {
+  } else if (isa<InvokeInst>(TI)) {
     // Invoke instructions successors are always executable.
     return true;
   } else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.46 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.47
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.46	Tue Oct 24 01:26:32 2006
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Thu Nov  2 14:25:50 2006
@@ -302,7 +302,7 @@
   if (const ArrayType *AT = dyn_cast<ArrayType>(*I)) {
     uint64_t NumElements = AT->getNumElements();
 
-    if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand())) {
+    if (isa<ConstantInt>(I.getOperand())) {
       // Check to make sure that index falls within the array.  If not,
       // something funny is going on, so we won't do the optimization.
       //


Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
diff -u llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.24 llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.25
--- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.24	Sun Oct 22 13:42:26 2006
+++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp	Thu Nov  2 14:25:50 2006
@@ -161,7 +161,6 @@
   // occurs when a function passes an argument straight through to its tail
   // call.
   if (!ArgumentPHIs.empty()) {
-    unsigned NumIncoming = ArgumentPHIs[0]->getNumIncomingValues();
     for (unsigned i = 0, e = ArgumentPHIs.size(); i != e; ++i) {
       PHINode *PN = ArgumentPHIs[i];
 






More information about the llvm-commits mailing list