[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp CorrelatedExprs.cpp DecomposeMultiDimRefs.cpp IndVarSimplify.cpp LICM.cpp LoopPreheaders.cpp LowerAllocations.cpp Mem2Reg.cpp Reassociate.cpp SCCP.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Apr 23 11:38:12 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

ADCE.cpp updated: 1.50 -> 1.51
CorrelatedExprs.cpp updated: 1.8 -> 1.9
DecomposeMultiDimRefs.cpp updated: 1.26 -> 1.27
IndVarSimplify.cpp updated: 1.32 -> 1.33
LICM.cpp updated: 1.26 -> 1.27
LoopPreheaders.cpp updated: 1.10 -> 1.11
LowerAllocations.cpp updated: 1.34 -> 1.35
Mem2Reg.cpp updated: 1.2 -> 1.3
Reassociate.cpp updated: 1.16 -> 1.17
SCCP.cpp updated: 1.64 -> 1.65

---
Log message:

Remove unnecesary &*'s



---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/ADCE.cpp
diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.50 llvm/lib/Transforms/Scalar/ADCE.cpp:1.51
--- llvm/lib/Transforms/Scalar/ADCE.cpp:1.50	Mon Feb 24 14:48:30 2003
+++ llvm/lib/Transforms/Scalar/ADCE.cpp	Wed Apr 23 11:37:42 2003
@@ -119,7 +119,7 @@
   for (BasicBlock::iterator I = BB->begin(), E = --BB->end(); I != E; )
     if (!LiveSet.count(I)) {              // Is this instruction alive?
       I->dropAllReferences();             // Nope, drop references... 
-      if (PHINode *PN = dyn_cast<PHINode>(&*I)) {
+      if (PHINode *PN = dyn_cast<PHINode>(I)) {
         // We don't want to leave PHI nodes in the program that have
         // #arguments != #predecessors, so we remove them now.
         //
@@ -310,7 +310,7 @@
               // should be identical to the incoming values for LastDead.
               //
               for (BasicBlock::iterator II = NextAlive->begin();
-                   PHINode *PN = dyn_cast<PHINode>(&*II); ++II) {
+                   PHINode *PN = dyn_cast<PHINode>(II); ++II) {
                 // Get the incoming value for LastDead...
                 int OldIdx = PN->getBasicBlockIndex(LastDead);
                 assert(OldIdx != -1 && "LastDead is not a pred of NextAlive!");


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.8 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.9
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.8	Fri Nov  8 17:18:37 2002
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp	Wed Apr 23 11:37:42 2003
@@ -450,11 +450,11 @@
     
   // 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)) {
+    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);      
-    } else if (SetCondInst *SCI = dyn_cast<SetCondInst>(&*I)) {
+    } else if (SetCondInst *SCI = dyn_cast<SetCondInst>(I)) {
       Relation::KnownResult Res = getSetCCResult(SCI, NewRI);
       if (Res == Relation::Unknown) return false;
       PropagateEquality(SCI, ConstantBool::get(Res), NewRI);
@@ -563,7 +563,7 @@
   // node with a new value.
   //
   for (BasicBlock::iterator I = OldSucc->begin();
-       PHINode *PN = dyn_cast<PHINode>(&*I); ) {
+       PHINode *PN = dyn_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
@@ -993,7 +993,7 @@
 bool CEE::SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI) {
   bool Changed = false;
   for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ) {
-    Instruction *Inst = &*I++;
+    Instruction *Inst = I++;
 
     // Convert instruction arguments to canonical forms...
     Changed |= SimplifyInstruction(Inst, RI);


Index: llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
diff -u llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.26 llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.27
--- llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.26	Tue Oct  1 17:38:41 2002
+++ llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp	Wed Apr 23 11:37:42 2003
@@ -44,7 +44,7 @@
 {
   bool changed = false;
   for (BasicBlock::iterator II = BB.begin(); II != BB.end(); )
-    if (GetElementPtrInst *gep = dyn_cast<GetElementPtrInst>(&*II++)) // pre-inc
+    if (GetElementPtrInst *gep = dyn_cast<GetElementPtrInst>(II++)) // pre-inc
       if (gep->getNumIndices() >= 2)
         changed |= DecomposeArrayRef(gep); // always modifies II
   return changed;


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.32 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.33
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.32	Mon Oct 21 15:00:26 2002
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp	Wed Apr 23 11:37:42 2003
@@ -45,7 +45,7 @@
   //
   std::vector<InductionVariable> IndVars;    // Induction variables for block
   BasicBlock::iterator AfterPHIIt = Header->begin();
-  for (; PHINode *PN = dyn_cast<PHINode>(&*AfterPHIIt); ++AfterPHIIt)
+  for (; PHINode *PN = dyn_cast<PHINode>(AfterPHIIt); ++AfterPHIIt)
     IndVars.push_back(InductionVariable(PN, Loops));
   // AfterPHIIt now points to first nonphi instruction...
 


Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.26 llvm/lib/Transforms/Scalar/LICM.cpp:1.27
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.26	Mon Mar  3 17:32:45 2003
+++ llvm/lib/Transforms/Scalar/LICM.cpp	Wed Apr 23 11:37:42 2003
@@ -319,12 +319,12 @@
     // Rewrite all loads and stores in the block of the pointer...
     for (BasicBlock::iterator II = (*I)->begin(), E = (*I)->end();
          II != E; ++II) {
-      if (LoadInst *L = dyn_cast<LoadInst>(&*II)) {
+      if (LoadInst *L = dyn_cast<LoadInst>(II)) {
         std::map<Value*, AllocaInst*>::iterator
           I = ValueToAllocaMap.find(L->getOperand(0));
         if (I != ValueToAllocaMap.end())
           L->setOperand(0, I->second);    // Rewrite load instruction...
-      } else if (StoreInst *S = dyn_cast<StoreInst>(&*II)) {
+      } else if (StoreInst *S = dyn_cast<StoreInst>(II)) {
         std::map<Value*, AllocaInst*>::iterator
           I = ValueToAllocaMap.find(S->getOperand(1));
         if (I != ValueToAllocaMap.end())


Index: llvm/lib/Transforms/Scalar/LoopPreheaders.cpp
diff -u llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.10 llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.11
--- llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.10	Fri Feb 28 10:54:17 2003
+++ llvm/lib/Transforms/Scalar/LoopPreheaders.cpp	Wed Apr 23 11:37:42 2003
@@ -132,7 +132,7 @@
   //
   if (!Preds.empty()) {  // Is the loop not obviously dead?
     for (BasicBlock::iterator I = BB->begin();
-         PHINode *PN = dyn_cast<PHINode>(&*I); ++I) {
+         PHINode *PN = dyn_cast<PHINode>(I); ++I) {
       
       // Create the new PHI node, insert it into NewBB at the end of the block
       PHINode *NewPHI = new PHINode(PN->getType(), PN->getName()+".ph", BI);
@@ -160,7 +160,7 @@
     
   } else {                       // Otherwise the loop is dead...
     for (BasicBlock::iterator I = BB->begin();
-         PHINode *PN = dyn_cast<PHINode>(&*I); ++I)
+         PHINode *PN = dyn_cast<PHINode>(I); ++I)
       // Insert dummy values as the incoming value...
       PN->addIncoming(Constant::getNullValue(PN->getType()), NewBB);
   }  


Index: llvm/lib/Transforms/Scalar/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.34 llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.35
--- llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.34	Wed Apr 23 11:18:14 2003
+++ llvm/lib/Transforms/Scalar/LowerAllocations.cpp	Wed Apr 23 11:37:42 2003
@@ -85,7 +85,7 @@
 
   // Loop over all of the instructions, looking for malloc or free instructions
   for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) {
-    if (MallocInst *MI = dyn_cast<MallocInst>(&*I)) {
+    if (MallocInst *MI = dyn_cast<MallocInst>(I)) {
       const Type *AllocTy = MI->getType()->getElementType();
       
       // Get the number of bytes to be allocated for one element of the
@@ -114,7 +114,7 @@
       I = --BBIL.erase(I);         // remove and delete the malloc instr...
       Changed = true;
       ++NumLowered;
-    } else if (FreeInst *FI = dyn_cast<FreeInst>(&*I)) {
+    } else if (FreeInst *FI = dyn_cast<FreeInst>(I)) {
       // Cast the argument to free into a ubyte*...
       CastInst *MCast = new CastInst(FI->getOperand(0), 
                                      PointerType::get(Type::UByteTy), "", I);


Index: llvm/lib/Transforms/Scalar/Mem2Reg.cpp
diff -u llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.2 llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.3
--- llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.2	Mon Mar  3 11:25:16 2003
+++ llvm/lib/Transforms/Scalar/Mem2Reg.cpp	Wed Apr 23 11:37:42 2003
@@ -43,7 +43,7 @@
   // Find allocas that are safe to promote, by looking at all instructions in
   // the entry node
   for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I)
-    if (AllocaInst *AI = dyn_cast<AllocaInst>(&*I))       // Is it an alloca?
+    if (AllocaInst *AI = dyn_cast<AllocaInst>(I))       // Is it an alloca?
       if (isAllocaPromotable(AI, TD))
         Allocas.push_back(AI);
 


Index: llvm/lib/Transforms/Scalar/Reassociate.cpp
diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.16 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.17
--- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.16	Mon Feb 24 14:48:30 2003
+++ llvm/lib/Transforms/Scalar/Reassociate.cpp	Wed Apr 23 11:37:42 2003
@@ -224,7 +224,7 @@
     // the two operands are sorted incorrectly, fix it now.
     //
     if (BI->isAssociative()) {
-      BinaryOperator *I = cast<BinaryOperator>(&*BI);
+      BinaryOperator *I = cast<BinaryOperator>(BI);
       if (!I->use_empty()) {
         // Make sure that we don't have a tree-shaped computation.  If we do,
         // linearize it.  Convert (A+B)+(C+D) into ((A+B)+C)+D


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.64 llvm/lib/Transforms/Scalar/SCCP.cpp:1.65
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.64	Sun Nov  3 20:54:22 2002
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Wed Apr 23 11:37:42 2003
@@ -474,7 +474,7 @@
       // constant now may not be.
       //
       for (BasicBlock::iterator I = Succ->begin();
-           PHINode *PN = dyn_cast<PHINode>(&*I); ++I)
+           PHINode *PN = dyn_cast<PHINode>(I); ++I)
         visitPHINode(*PN);
     }
 }





More information about the llvm-commits mailing list