? diffs.txt Index: lib/Analysis/LoopInfo.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Analysis/LoopInfo.cpp,v retrieving revision 1.59 diff -u -r1.59 LoopInfo.cpp --- lib/Analysis/LoopInfo.cpp 3 Sep 2004 18:19:51 -0000 1.59 +++ lib/Analysis/LoopInfo.cpp 15 Sep 2004 07:01:14 -0000 @@ -404,15 +404,15 @@ return 0; // Loop over all of the PHI nodes, looking for a canonical indvar. - for (BasicBlock::iterator I = H->begin(); - PHINode *PN = dyn_cast(I); ++I) + for (BasicBlock::iterator I = H->begin(); isa(I); ++I) { + PHINode *PN = cast(I); if (Instruction *Inc = dyn_cast(PN->getIncomingValueForBlock(Backedge))) if (Inc->getOpcode() == Instruction::Add && Inc->getOperand(0) == PN) if (ConstantInt *CI = dyn_cast(Inc->getOperand(1))) if (CI->equalsInt(1)) return PN; - + } return 0; } Index: lib/Bytecode/Reader/Reader.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Bytecode/Reader/Reader.cpp,v retrieving revision 1.129 diff -u -r1.129 Reader.cpp --- lib/Bytecode/Reader/Reader.cpp 3 Sep 2004 18:19:51 -0000 1.129 +++ lib/Bytecode/Reader/Reader.cpp 15 Sep 2004 07:01:15 -0000 @@ -347,14 +347,14 @@ } // Check the function level types first... - TypeListTy::iterator I = find(FunctionTypes.begin(), FunctionTypes.end(), Ty); + TypeListTy::iterator I = std::find(FunctionTypes.begin(), FunctionTypes.end(), Ty); if (I != FunctionTypes.end()) return Type::FirstDerivedTyID + ModuleTypes.size() + (&*I - &FunctionTypes[0]); // Check the module level types now... - I = find(ModuleTypes.begin(), ModuleTypes.end(), Ty); + I = std::find(ModuleTypes.begin(), ModuleTypes.end(), Ty); if (I == ModuleTypes.end()) error("Didn't find type in ModuleTypes."); return Type::FirstDerivedTyID + (&*I - &ModuleTypes[0]); @@ -381,7 +381,7 @@ unsigned BytecodeReader::getGlobalTableTypeSlot(const Type *Ty) { if (Ty->isPrimitiveType()) return Ty->getTypeID(); - TypeListTy::iterator I = find(ModuleTypes.begin(), + TypeListTy::iterator I = std::find(ModuleTypes.begin(), ModuleTypes.end(), Ty); if (I == ModuleTypes.end()) error("Didn't find type in ModuleTypes."); Index: lib/ExecutionEngine/Interpreter/Execution.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp,v retrieving revision 1.132 diff -u -r1.132 Execution.cpp --- lib/ExecutionEngine/Interpreter/Execution.cpp 1 Sep 2004 22:55:35 -0000 1.132 +++ lib/ExecutionEngine/Interpreter/Execution.cpp 15 Sep 2004 07:01:16 -0000 @@ -679,9 +679,10 @@ // Now loop over all of the PHI nodes setting their values... SF.CurInst = SF.CurBB->begin(); - for (unsigned i = 0; PHINode *PN = dyn_cast(SF.CurInst); - ++SF.CurInst, ++i) + for (unsigned i = 0; isa(SF.CurInst); ++SF.CurInst, ++i) { + PHINode *PN = cast(SF.CurInst); SetValue(PN, ResultValues[i], SF); + } } //===----------------------------------------------------------------------===// Index: lib/Target/X86/X86ISelSimple.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Target/X86/X86ISelSimple.cpp,v retrieving revision 1.278 diff -u -r1.278 X86ISelSimple.cpp --- lib/Target/X86/X86ISelSimple.cpp 1 Sep 2004 22:55:36 -0000 1.278 +++ lib/Target/X86/X86ISelSimple.cpp 15 Sep 2004 07:01:17 -0000 @@ -643,8 +643,8 @@ // Loop over all of the PHI nodes in the LLVM basic block... MachineBasicBlock::iterator PHIInsertPoint = MBB.begin(); - for (BasicBlock::const_iterator I = BB->begin(); - PHINode *PN = const_cast(dyn_cast(I)); ++I) { + for (BasicBlock::const_iterator I = BB->begin(); isa(I); ++I) { + PHINode *PN = const_cast(dyn_cast(I)); // Create a new machine instr PHI node, and insert it. unsigned PHIReg = getReg(*PN); Index: lib/Transforms/Scalar/ADCE.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/ADCE.cpp,v retrieving revision 1.79 diff -u -r1.79 ADCE.cpp --- lib/Transforms/Scalar/ADCE.cpp 1 Sep 2004 22:55:36 -0000 1.79 +++ lib/Transforms/Scalar/ADCE.cpp 15 Sep 2004 07:01:18 -0000 @@ -428,7 +428,8 @@ // should be identical to the incoming values for LastDead. // for (BasicBlock::iterator II = NextAlive->begin(); - PHINode *PN = dyn_cast(II); ++II) + isa(II); ++II) { + PHINode *PN = cast(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: lib/Transforms/Scalar/CorrelatedExprs.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp,v retrieving revision 1.24 diff -u -r1.24 CorrelatedExprs.cpp --- lib/Transforms/Scalar/CorrelatedExprs.cpp 1 Sep 2004 22:55:36 -0000 1.24 +++ lib/Transforms/Scalar/CorrelatedExprs.cpp 15 Sep 2004 07:01:19 -0000 @@ -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(I); ) { + for (BasicBlock::iterator I = OldSucc->begin(); isa(I); ) { + PHINode *PN = cast(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: lib/Transforms/Scalar/IndVarSimplify.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp,v retrieving revision 1.69 diff -u -r1.69 IndVarSimplify.cpp --- lib/Transforms/Scalar/IndVarSimplify.cpp 1 Sep 2004 22:55:36 -0000 1.69 +++ lib/Transforms/Scalar/IndVarSimplify.cpp 15 Sep 2004 07:01:19 -0000 @@ -570,10 +570,11 @@ BasicBlock *Preheader = L->getLoopPreheader(); std::set DeadInsts; - for (BasicBlock::iterator I = Header->begin(); - PHINode *PN = dyn_cast(I); ++I) + for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) { + PHINode *PN = cast(I); if (isa(PN->getType())) EliminatePointerRecurrence(PN, Preheader, DeadInsts); + } if (!DeadInsts.empty()) DeleteTriviallyDeadInstructions(DeadInsts); @@ -597,8 +598,8 @@ // auxillary induction variables. std::vector > IndVars; - for (BasicBlock::iterator I = Header->begin(); - PHINode *PN = dyn_cast(I); ++I) + for (BasicBlock::iterator I = Header->begin(); isa(I); ++I) { + PHINode *PN = cast(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(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: lib/Transforms/Scalar/LoopUnroll.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LoopUnroll.cpp,v retrieving revision 1.11 diff -u -r1.11 LoopUnroll.cpp --- lib/Transforms/Scalar/LoopUnroll.cpp 1 Sep 2004 22:55:36 -0000 1.11 +++ lib/Transforms/Scalar/LoopUnroll.cpp 15 Sep 2004 07:01:20 -0000 @@ -155,8 +155,8 @@ // PHI nodes. Insert associations now. std::map LastValueMap; std::vector OrigPHINode; - for (BasicBlock::iterator I = BB->begin(); - PHINode *PN = dyn_cast(I); ++I) { + for (BasicBlock::iterator I = BB->begin(); isa(I); ++I) { + PHINode *PN = cast(I); OrigPHINode.push_back(PN); if (Instruction *I =dyn_cast(PN->getIncomingValueForBlock(BB))) if (I->getParent() == BB) Index: lib/Transforms/Scalar/LowerSwitch.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerSwitch.cpp,v retrieving revision 1.15 diff -u -r1.15 LowerSwitch.cpp --- lib/Transforms/Scalar/LowerSwitch.cpp 3 Sep 2004 18:19:51 -0000 1.15 +++ lib/Transforms/Scalar/LowerSwitch.cpp 15 Sep 2004 07:01:20 -0000 @@ -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(I); ++I) { + for (BasicBlock::iterator I = Succ->begin(); isa(I); ++I) { + PHINode* PN = cast(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(I); ++I) { + for (BasicBlock::iterator I = Default->begin(); isa(I); ++I) { + PHINode *PN = cast(I); int BlockIdx = PN->getBasicBlockIndex(OrigBlock); assert(BlockIdx != -1 && "Switch didn't go to this successor??"); PN->setIncomingBlock((unsigned)BlockIdx, NewDefault); Index: lib/Transforms/Scalar/SCCP.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/SCCP.cpp,v retrieving revision 1.100 diff -u -r1.100 SCCP.cpp --- lib/Transforms/Scalar/SCCP.cpp 1 Sep 2004 22:55:36 -0000 1.100 +++ lib/Transforms/Scalar/SCCP.cpp 15 Sep 2004 07:01:20 -0000 @@ -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(I); ++I) + for (BasicBlock::iterator I = Dest->begin(); isa(I); ++I) { + PHINode *PN = cast(I); visitPHINode(*PN); + } } else { DEBUG(std::cerr << "Marking Block Executable: " << Dest->getName()<<"\n"); Index: lib/Transforms/Scalar/TailDuplication.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/TailDuplication.cpp,v retrieving revision 1.22 diff -u -r1.22 TailDuplication.cpp --- lib/Transforms/Scalar/TailDuplication.cpp 1 Sep 2004 22:55:36 -0000 1.22 +++ lib/Transforms/Scalar/TailDuplication.cpp 15 Sep 2004 07:01:20 -0000 @@ -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(PNI); ++PNI) { + for (BasicBlock::iterator PNI = Succ->begin(); isa(PNI); ++PNI) { + PHINode *PN = cast(PNI); // Ok, we have a PHI node. Figure out what the incoming value was for the // DestBlock. Value *IV = PN->getIncomingValueForBlock(DestBlock); Index: lib/Transforms/Utils/BreakCriticalEdges.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp,v retrieving revision 1.23 diff -u -r1.23 BreakCriticalEdges.cpp --- lib/Transforms/Utils/BreakCriticalEdges.cpp 1 Sep 2004 22:55:36 -0000 1.23 +++ lib/Transforms/Utils/BreakCriticalEdges.cpp 15 Sep 2004 07:01:20 -0000 @@ -118,8 +118,8 @@ // If there are any PHI nodes in DestBB, we need to update them so that they // merge incoming values from NewBB instead of from TIBB. // - for (BasicBlock::iterator I = DestBB->begin(); - PHINode *PN = dyn_cast(I); ++I) { + for (BasicBlock::iterator I = DestBB->begin(); isa(I); ++I) { + PHINode *PN = cast(I); // We no longer enter through TIBB, now we come in through NewBB. Revector // exactly one entry in the PHI node that used to come from TIBB to come // from NewBB. Index: lib/Transforms/Utils/CloneTrace.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Utils/CloneTrace.cpp,v retrieving revision 1.8 diff -u -r1.8 CloneTrace.cpp --- lib/Transforms/Utils/CloneTrace.cpp 29 Jul 2004 17:21:57 -0000 1.8 +++ lib/Transforms/Utils/CloneTrace.cpp 15 Sep 2004 07:01:20 -0000 @@ -50,16 +50,17 @@ //only do this if we are NOT the first block if(T != origTrace.begin()) { for (BasicBlock::iterator I = clonedBlock->begin(); - PHINode *PN = dyn_cast(I); ++I) { - //get incoming value for the previous BB - Value *V = PN->getIncomingValueForBlock(*(T-1)); - assert(V && "No incoming value from a BasicBlock in our trace!"); - - //remap our phi node to point to incoming value - ValueMap[*&I] = V; - - //remove phi node - clonedBlock->getInstList().erase(PN); + isa(I); ++I) { + PHINode *PN = cast(I); + //get incoming value for the previous BB + Value *V = PN->getIncomingValueForBlock(*(T-1)); + assert(V && "No incoming value from a BasicBlock in our trace!"); + + //remap our phi node to point to incoming value + ValueMap[*&I] = V; + + //remove phi node + clonedBlock->getInstList().erase(PN); } } } Index: lib/Transforms/Utils/CodeExtractor.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Utils/CodeExtractor.cpp,v retrieving revision 1.31 diff -u -r1.31 CodeExtractor.cpp --- lib/Transforms/Utils/CodeExtractor.cpp 1 Sep 2004 22:55:36 -0000 1.31 +++ lib/Transforms/Utils/CodeExtractor.cpp 15 Sep 2004 07:01:21 -0000 @@ -166,8 +166,8 @@ // Okay, everthing within the region is now branching to the right block, we // just have to update the PHI nodes now, inserting PHI nodes into NewBB. - for (AfterPHIs = OldPred->begin(); - PHINode *PN = dyn_cast(AfterPHIs); ++AfterPHIs) { + for (AfterPHIs = OldPred->begin(); isa(AfterPHIs); ++AfterPHIs) { + PHINode *PN = cast(AfterPHIs); // Create a new PHI node in the new region, which has an incoming value // from OldPred of PN. PHINode *NewPN = new PHINode(PN->getType(), PN->getName()+".ce", @@ -644,20 +644,21 @@ // Loop over all of the PHI nodes in the header block, and change any // references to the old incoming edge to be the new incoming edge. - for (BasicBlock::iterator I = header->begin(); - PHINode *PN = dyn_cast(I); ++I) + for (BasicBlock::iterator I = header->begin(); isa(I); ++I) { + PHINode *PN = cast(I); for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (!BlocksToExtract.count(PN->getIncomingBlock(i))) PN->setIncomingBlock(i, newFuncRoot); - + } + // Look at all successors of the codeReplacer block. If any of these blocks // had PHI nodes in them, we need to update the "from" block to be the code // replacer, not the original block in the extracted region. std::vector Succs(succ_begin(codeReplacer), succ_end(codeReplacer)); for (unsigned i = 0, e = Succs.size(); i != e; ++i) - for (BasicBlock::iterator I = Succs[i]->begin(); - PHINode *PN = dyn_cast(I); ++I) { + for (BasicBlock::iterator I = Succs[i]->begin(); isa(I); ++I) { + PHINode *PN = cast(I); std::set ProcessedPreds; for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (BlocksToExtract.count(PN->getIncomingBlock(i))) Index: lib/Transforms/Utils/InlineFunction.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Utils/InlineFunction.cpp,v retrieving revision 1.26 diff -u -r1.26 InlineFunction.cpp --- lib/Transforms/Utils/InlineFunction.cpp 20 Jul 2004 05:45:24 -0000 1.26 +++ lib/Transforms/Utils/InlineFunction.cpp 15 Sep 2004 07:01:21 -0000 @@ -111,10 +111,11 @@ // If there are PHI nodes in the exceptional destination block, we need to // keep track of which values came into them from this invoke, then remove // the entry for this block. - for (BasicBlock::iterator I = InvokeDest->begin(); - PHINode *PN = dyn_cast(I); ++I) + for (BasicBlock::iterator I = InvokeDest->begin(); isa(I); ++I) { + PHINode *PN = cast(I); // Save the value to use for this edge... InvokeDestPHIValues.push_back(PN->getIncomingValueForBlock(OrigBB)); + } for (Function::iterator BB = FirstNewBlock, E = Caller->end(); BB != E; ++BB) { @@ -149,8 +150,10 @@ // there is now a new entry in them. unsigned i = 0; for (BasicBlock::iterator I = InvokeDest->begin(); - PHINode *PN = dyn_cast(I); ++I, ++i) + isa(I); ++I, ++i) { + PHINode *PN = cast(I); PN->addIncoming(InvokeDestPHIValues[i], BB); + } // This basic block is now complete, start scanning the next one. break; @@ -174,8 +177,10 @@ // there is now a new entry in them. unsigned i = 0; for (BasicBlock::iterator I = InvokeDest->begin(); - PHINode *PN = dyn_cast(I); ++I, ++i) + isa(I); ++I, ++i) { + PHINode *PN = cast(I); PN->addIncoming(InvokeDestPHIValues[i], BB); + } } } Index: lib/Transforms/Utils/SimplifyCFG.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Utils/SimplifyCFG.cpp,v retrieving revision 1.51 diff -u -r1.51 SimplifyCFG.cpp --- lib/Transforms/Utils/SimplifyCFG.cpp 3 Sep 2004 18:19:51 -0000 1.51 +++ lib/Transforms/Utils/SimplifyCFG.cpp 15 Sep 2004 07:01:21 -0000 @@ -52,8 +52,8 @@ if (std::find(BBPreds.begin(), BBPreds.end(), *PI) != BBPreds.end()) { // Loop over all of the PHI nodes checking to see if there are // incompatible values coming in. - for (BasicBlock::iterator I = Succ->begin(); - PHINode *PN = dyn_cast(I); ++I) { + for (BasicBlock::iterator I = Succ->begin(); isa(I); ++I) { + PHINode *PN = cast(I); // Loop up the entries in the PHI node for BB and for *PI if the values // coming in are non-equal, we cannot merge these two blocks (instead we // should insert a conditional move or something, then merge the @@ -68,8 +68,8 @@ } // Loop over all of the PHI nodes in the successor BB. - for (BasicBlock::iterator I = Succ->begin(); - PHINode *PN = dyn_cast(I); ++I) { + for (BasicBlock::iterator I = Succ->begin(); isa(I); ++I) { + PHINode *PN = cast(I); Value *OldVal = PN->removeIncomingValue(BB, false); assert(OldVal && "No entry in PHI for Pred BB!"); @@ -341,10 +341,12 @@ for (succ_iterator I = succ_begin(SI2BB), E = succ_end(SI2BB); I != E; ++I) if (SI1Succs.count(*I)) for (BasicBlock::iterator BBI = (*I)->begin(); - PHINode *PN = dyn_cast(BBI); ++BBI) + isa(BBI); ++BBI) { + PHINode *PN = cast(BBI); if (PN->getIncomingValueForBlock(SI1BB) != PN->getIncomingValueForBlock(SI2BB)) return false; + } return true; } @@ -359,8 +361,8 @@ succ_end(ExistPred) && "ExistPred is not a predecessor of Succ!"); if (!isa(Succ->begin())) return; // Quick exit if nothing to do - for (BasicBlock::iterator I = Succ->begin(); - PHINode *PN = dyn_cast(I); ++I) { + for (BasicBlock::iterator I = Succ->begin(); isa(I); ++I) { + PHINode *PN = cast(I); Value *V = PN->getIncomingValueForBlock(ExistPred); PN->addIncoming(V, NewPred); } @@ -994,7 +996,8 @@ // PHI nodes in EdgeBB, they need entries to be added corresponding to // the number of edges added. for (BasicBlock::iterator BBI = EdgeBB->begin(); - PHINode *PN = dyn_cast(BBI); ++BBI) { + isa(BBI); ++BBI) { + PHINode *PN = cast(BBI); Value *InVal = PN->getIncomingValueForBlock(*PI); for (unsigned i = 0, e = Values.size()-1; i != e; ++i) PN->addIncoming(InVal, *PI);