[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp CorrelatedExprs.cpp IndVarSimplify.cpp LoopUnroll.cpp LowerSwitch.cpp SCCP.cpp TailDuplication.cpp

Reid Spencer reid at x10sys.com
Wed Sep 15 10:06:53 PDT 2004



Changes in directory llvm/lib/Transforms/Scalar:

ADCE.cpp updated: 1.79 -> 1.80
CorrelatedExprs.cpp updated: 1.24 -> 1.25
IndVarSimplify.cpp updated: 1.69 -> 1.70
LoopUnroll.cpp updated: 1.11 -> 1.12
LowerSwitch.cpp updated: 1.15 -> 1.16
SCCP.cpp updated: 1.100 -> 1.101
TailDuplication.cpp updated: 1.22 -> 1.23
---
Log message:

Convert code to compile with vc7.1.

Patch contributed by Paolo Invernizzi. Thanks Paolo!


---
Diffs of the changes:  (+22 -17)

Index: llvm/lib/Transforms/Scalar/ADCE.cpp
diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.79 llvm/lib/Transforms/Scalar/ADCE.cpp:1.80
--- llvm/lib/Transforms/Scalar/ADCE.cpp:1.79	Wed Sep  1 17:55:36 2004
+++ llvm/lib/Transforms/Scalar/ADCE.cpp	Wed Sep 15 12:06:41 2004
@@ -428,7 +428,8 @@
               // should be identical to the incoming values for LastDead.
               //
               for (BasicBlock::iterator II = NextAlive->begin();
-                   PHINode *PN = dyn_cast<PHINode>(II); ++II)
+                   isa<PHINode>(II); ++II) {
+                PHINode *PN = cast<PHINode>(II);
                 if (LiveSet.count(PN)) {  // Only modify live phi nodes
                   // Get the incoming value for LastDead...
                   int OldIdx = PN->getBasicBlockIndex(LastDead);
@@ -438,6 +439,7 @@
                   // Add an incoming value for BB now...
                   PN->addIncoming(InVal, BB);
                 }
+              }
             }
           }
 


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.24 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.25
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.24	Wed Sep  1 17:55:36 2004
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp	Wed Sep 15 12:06:41 2004
@@ -572,8 +572,8 @@
   // edge from the PHI node, and we need to replace any references to the PHI
   // node with a new value.
   //
-  for (BasicBlock::iterator I = OldSucc->begin();
-       PHINode *PN = dyn_cast<PHINode>(I); ) {
+  for (BasicBlock::iterator I = OldSucc->begin(); isa<PHINode>(I); ) {
+    PHINode *PN = cast<PHINode>(I);
 
     // Get the value flowing across the old edge and remove the PHI node entry
     // for this edge: we are about to remove the edge!  Don't remove the PHI


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.69 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.70
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.69	Wed Sep  1 17:55:36 2004
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp	Wed Sep 15 12:06:41 2004
@@ -570,10 +570,11 @@
   BasicBlock *Preheader = L->getLoopPreheader();
   
   std::set<Instruction*> DeadInsts;
-  for (BasicBlock::iterator I = Header->begin();
-       PHINode *PN = dyn_cast<PHINode>(I); ++I)
+  for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
+    PHINode *PN = cast<PHINode>(I);
     if (isa<PointerType>(PN->getType()))
       EliminatePointerRecurrence(PN, Preheader, DeadInsts);
+  }
 
   if (!DeadInsts.empty())
     DeleteTriviallyDeadInstructions(DeadInsts);
@@ -597,8 +598,8 @@
   // auxillary induction variables.
   std::vector<std::pair<PHINode*, SCEVHandle> > IndVars;
 
-  for (BasicBlock::iterator I = Header->begin();
-       PHINode *PN = dyn_cast<PHINode>(I); ++I)
+  for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
+    PHINode *PN = cast<PHINode>(I);
     if (PN->getType()->isInteger()) {  // FIXME: when we have fast-math, enable!
       SCEVHandle SCEV = SE->getSCEV(PN);
       if (SCEV->hasComputableLoopEvolution(L))
@@ -611,6 +612,7 @@
           if (AR->getNumOperands() == 2 && isa<SCEVConstant>(AR->getOperand(1)))
             IndVars.push_back(std::make_pair(PN, SCEV));
     }
+  }
 
   // If there are no induction variables in the loop, there is nothing more to
   // do.


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.11 llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.12
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.11	Wed Sep  1 17:55:36 2004
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp	Wed Sep 15 12:06:41 2004
@@ -155,8 +155,8 @@
   // PHI nodes.  Insert associations now.
   std::map<const Value*, Value*> LastValueMap;
   std::vector<PHINode*> OrigPHINode;
-  for (BasicBlock::iterator I = BB->begin();
-       PHINode *PN = dyn_cast<PHINode>(I); ++I) {
+  for (BasicBlock::iterator I = BB->begin(); isa<PHINode>(I); ++I) {
+    PHINode *PN = cast<PHINode>(I);
     OrigPHINode.push_back(PN);
     if (Instruction *I =dyn_cast<Instruction>(PN->getIncomingValueForBlock(BB)))
       if (I->getParent() == BB)


Index: llvm/lib/Transforms/Scalar/LowerSwitch.cpp
diff -u llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.15 llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.16
--- llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.15	Fri Sep  3 13:19:51 2004
+++ llvm/lib/Transforms/Scalar/LowerSwitch.cpp	Wed Sep 15 12:06:41 2004
@@ -160,8 +160,8 @@
 
   // If there were any PHI nodes in this successor, rewrite one entry
   // from OrigBlock to come from NewLeaf.
-  for (BasicBlock::iterator I = Succ->begin();
-       PHINode* PN = dyn_cast<PHINode>(I); ++I) {
+  for (BasicBlock::iterator I = Succ->begin(); isa<PHINode>(I); ++I) {
+    PHINode* PN = cast<PHINode>(I);
     int BlockIdx = PN->getBasicBlockIndex(OrigBlock);
     assert(BlockIdx != -1 && "Switch didn't go to this successor??");
     PN->setIncomingBlock((unsigned)BlockIdx, NewLeaf);
@@ -196,8 +196,8 @@
 
   // If there is an entry in any PHI nodes for the default edge, make sure
   // to update them as well.
-  for (BasicBlock::iterator I = Default->begin();
-       PHINode *PN = dyn_cast<PHINode>(I); ++I) {
+  for (BasicBlock::iterator I = Default->begin(); isa<PHINode>(I); ++I) {
+    PHINode *PN = cast<PHINode>(I);
     int BlockIdx = PN->getBasicBlockIndex(OrigBlock);
     assert(BlockIdx != -1 && "Switch didn't go to this successor??");
     PN->setIncomingBlock((unsigned)BlockIdx, NewDefault);


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.100 llvm/lib/Transforms/Scalar/SCCP.cpp:1.101
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.100	Wed Sep  1 17:55:36 2004
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Wed Sep 15 12:06:41 2004
@@ -198,9 +198,10 @@
       // The destination is already executable, but we just made an edge
       // feasible that wasn't before.  Revisit the PHI nodes in the block
       // because they have potentially new operands.
-      for (BasicBlock::iterator I = Dest->begin();
-           PHINode *PN = dyn_cast<PHINode>(I); ++I)
+      for (BasicBlock::iterator I = Dest->begin(); isa<PHINode>(I); ++I) {
+        PHINode *PN = cast<PHINode>(I);
         visitPHINode(*PN);
+      }
 
     } else {
       DEBUG(std::cerr << "Marking Block Executable: " << Dest->getName()<<"\n");


Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.22 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.23
--- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.22	Wed Sep  1 17:55:36 2004
+++ llvm/lib/Transforms/Scalar/TailDuplication.cpp	Wed Sep 15 12:06:42 2004
@@ -214,8 +214,8 @@
   for (succ_iterator SI = succ_begin(DestBlock), SE = succ_end(DestBlock);
        SI != SE; ++SI) {
     BasicBlock *Succ = *SI;
-    for (BasicBlock::iterator PNI = Succ->begin();
-         PHINode *PN = dyn_cast<PHINode>(PNI); ++PNI) {
+    for (BasicBlock::iterator PNI = Succ->begin(); isa<PHINode>(PNI); ++PNI) {
+      PHINode *PN = cast<PHINode>(PNI);
       // Ok, we have a PHI node.  Figure out what the incoming value was for the
       // DestBlock.
       Value *IV = PN->getIncomingValueForBlock(DestBlock);






More information about the llvm-commits mailing list