diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index afa4890f035..a2dbf2ef4cf 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -169,7 +169,7 @@ static inline bool ShouldInlineFunction(const CallInst *CI, const Function *F) { static inline bool DoFunctionInlining(BasicBlock *BB) { for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) { - if (CallInst *CI = dyn_cast(&*I)) { + if (CallInst *CI = dyn_cast(I)) { // Check to see if we should inline this function Function *F = CI->getCalledFunction(); if (F && ShouldInlineFunction(CI, F)) { diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp index 8fabbc9ca39..61c60ec7c5e 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp @@ -386,7 +386,7 @@ void insertBB(Edge ed, for(BasicBlock::iterator BB2Inst = BB2->begin(), BBend = BB2->end(); BB2Inst != BBend; ++BB2Inst){ - if(PHINode *phiInst=dyn_cast(&*BB2Inst)){ + if(PHINode *phiInst=dyn_cast(BB2Inst)){ int bbIndex=phiInst->getBasicBlockIndex(BB1); assert(bbIndex>=0); phiInst->setIncomingBlock(bbIndex, newBB); diff --git a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp index c876238a1e1..64075c8024e 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp @@ -133,7 +133,7 @@ void getBackEdgesVisit(BasicBlock *u, for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end(); BB2Inst != BBend; ++BB2Inst){ - if(PHINode *phiInst=dyn_cast(&*BB2Inst)){ + if (PHINode *phiInst = dyn_cast(BB2Inst)){ int bbIndex = phiInst->getBasicBlockIndex(u); if(bbIndex>=0){ phiInst->setIncomingBlock(bbIndex, newBB); diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index 57b17a590ff..79b94e8755c 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -87,7 +87,7 @@ bool ProfilePaths::runOnFunction(Function &F){ nodes.push_back(nd); if(&*BB == ExitNode) exitNode=nd; - if(&*BB==F.begin()) + if(BB==F.begin()) startNode=nd; } diff --git a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp index c222bdfb344..805250fd9a0 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp @@ -140,7 +140,7 @@ void getBBtrace(vector &vBB, int pathNo, Function *M){//, BasicBlock *ExitNode = 0; for (Function::iterator I = M->begin(), E = M->end(); I != E; ++I){ if (isa(I->getTerminator())) { - ExitNode = &*I; + ExitNode = I; break; } } @@ -160,7 +160,7 @@ void getBBtrace(vector &vBB, int pathNo, Function *M){//, if(BB->size()==3 || BB->size() ==2){ for(BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE; ++II){ - if(CallInst *callInst = dyn_cast(&*II)){ + if(CallInst *callInst = dyn_cast(II)){ //std::cerr<<*callInst; Function *calledFunction = callInst->getCalledFunction(); if(calledFunction && calledFunction->getName() == "trigger"){ @@ -199,7 +199,7 @@ void getBBtrace(vector &vBB, int pathNo, Function *M){//, continue; //if(BB->size()==3) - //if(CallInst *callInst = dyn_cast(&*BB->getInstList().begin())) + //if(CallInst *callInst = dyn_cast(BB->getInstList().begin())) //if(callInst->getCalledFunction()->getName() == "trigger") //continue; @@ -216,20 +216,20 @@ void getBBtrace(vector &vBB, int pathNo, Function *M){//, Node *nd=findBB(nodes, BB); assert(nd && "No node for this edge!"); - for(BasicBlock::succ_iterator s=succ_begin(&*BB), se=succ_end(&*BB); + for(BasicBlock::succ_iterator s=succ_begin(BB), se=succ_end(BB); s!=se; ++s){ if(triggerBBs[*s] == 9){ //if(!pathReg[M]){ //Get the path register for this! //if(BB->size()>8) - // if(LoadInst *ldInst = dyn_cast(&*BB->getInstList().begin())) + // if(LoadInst *ldInst = dyn_cast(BB->getInstList().begin())) // pathReg[M] = ldInst->getPointerOperand(); //} continue; } //if((*s)->size()==3) //if(CallInst *callInst = - // dyn_cast(&*(*s)->getInstList().begin())) + // dyn_cast((*s)->getInstList().begin())) // if(callInst->getCalledFunction()->getName() == "trigger") // continue; @@ -284,11 +284,11 @@ void getBBtrace(vector &vBB, int pathNo, Function *M){//, VBI != VBE; ++VBI){ for(BasicBlock::iterator BBI = (*VBI)->begin(), BBE = (*VBI)->end(); BBI != BBE; ++BBI){ - if(LoadInst *ldInst = dyn_cast(&*BBI)){ + if(LoadInst *ldInst = dyn_cast(BBI)){ if(pathReg[M] == ldInst->getPointerOperand()) instToErase.push_back(ldInst); } - else if(StoreInst *stInst = dyn_cast(&*BBI)){ + else if(StoreInst *stInst = dyn_cast(BBI)){ if(pathReg[M] == stInst->getPointerOperand()) instToErase.push_back(stInst); } diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index 75149ce9123..499bc4cf9d0 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -298,9 +298,9 @@ ReleasePtrSeqNumbers(BasicBlock *BB, ExternalFuncs& externalFuncs) { for (BasicBlock::iterator II=BB->begin(), IE = BB->end(); II != IE; ++II) - if (FreeInst *FI = dyn_cast(&*II)) + if (FreeInst *FI = dyn_cast(II)) InsertReleaseInst(FI->getOperand(0), BB, FI,externalFuncs.ReleasePtrFunc); - else if (AllocaInst *AI = dyn_cast(&*II)) + else if (AllocaInst *AI = dyn_cast(II)) InsertRecordInst(AI, BB, AI->getNext(), externalFuncs.RecordPtrFunc); } @@ -332,7 +332,7 @@ static void TraceValuesAtBBExit(BasicBlock *BB, // instruction *preceding* InsertPos to check when to terminate the loop. // for (BasicBlock::iterator II = BB->begin(); &*II != InsertPos; ++II) { - if (StoreInst *SI = dyn_cast(&*II)) { + if (StoreInst *SI = dyn_cast(II)) { assert(valuesStoredInFunction && "Should not be printing a store instruction at function exit"); LoadInst *LI = new LoadInst(SI->getPointerOperand(), "reload." + diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index e7bc1357ffe..5e2a2755fb7 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -119,7 +119,7 @@ bool ADCE::dropReferencesOfDeadInstructionsInLiveBlock(BasicBlock *BB) { 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(&*I)) { + if (PHINode *PN = dyn_cast(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 @@ bool ADCE::doADCE() { // should be identical to the incoming values for LastDead. // for (BasicBlock::iterator II = NextAlive->begin(); - PHINode *PN = dyn_cast(&*II); ++II) { + PHINode *PN = dyn_cast(II); ++II) { // Get the incoming value for LastDead... int OldIdx = PN->getBasicBlockIndex(LastDead); assert(OldIdx != -1 && "LastDead is not a pred of NextAlive!"); diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp index cb8bd6109c1..c560e836975 100644 --- a/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp @@ -450,11 +450,11 @@ bool CEE::ForwardCorrelatedEdgeDestination(TerminatorInst *TI, unsigned SuccNo, // 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(&*I)) { + if (PHINode *PN = dyn_cast(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(&*I)) { + } else if (SetCondInst *SCI = dyn_cast(I)) { Relation::KnownResult Res = getSetCCResult(SCI, NewRI); if (Res == Relation::Unknown) return false; PropagateEquality(SCI, ConstantBool::get(Res), NewRI); @@ -563,7 +563,7 @@ void CEE::ForwardSuccessorTo(TerminatorInst *TI, unsigned SuccNo, // node with a new value. // for (BasicBlock::iterator I = OldSucc->begin(); - PHINode *PN = dyn_cast(&*I); ) { + PHINode *PN = dyn_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 @@ -993,7 +993,7 @@ void CEE::ComputeReplacements(RegionInfo &RI) { 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); diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index d0f47d8b806..65cf465acd9 100644 --- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -44,7 +44,7 @@ DecomposePass::runOnBasicBlock(BasicBlock &BB) { bool changed = false; for (BasicBlock::iterator II = BB.begin(); II != BB.end(); ) - if (GetElementPtrInst *gep = dyn_cast(&*II++)) // pre-inc + if (GetElementPtrInst *gep = dyn_cast(II++)) // pre-inc if (gep->getNumIndices() >= 2) changed |= DecomposeArrayRef(gep); // always modifies II return changed; diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index ff2b9939c70..993e533abc7 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -45,7 +45,7 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { // std::vector IndVars; // Induction variables for block BasicBlock::iterator AfterPHIIt = Header->begin(); - for (; PHINode *PN = dyn_cast(&*AfterPHIIt); ++AfterPHIIt) + for (; PHINode *PN = dyn_cast(AfterPHIIt); ++AfterPHIIt) IndVars.push_back(InductionVariable(PN, Loops)); // AfterPHIIt now points to first nonphi instruction... diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 3df11a5ca28..9069338e323 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -319,12 +319,12 @@ void LICM::PromoteValuesInLoop() { // 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(&*II)) { + if (LoadInst *L = dyn_cast(II)) { std::map::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(&*II)) { + } else if (StoreInst *S = dyn_cast(II)) { std::map::iterator I = ValueToAllocaMap.find(S->getOperand(1)); if (I != ValueToAllocaMap.end()) diff --git a/lib/Transforms/Scalar/LoopSimplify.cpp b/lib/Transforms/Scalar/LoopSimplify.cpp index 5a68dda1af3..d5988b16526 100644 --- a/lib/Transforms/Scalar/LoopSimplify.cpp +++ b/lib/Transforms/Scalar/LoopSimplify.cpp @@ -132,7 +132,7 @@ BasicBlock *Preheaders::SplitBlockPredecessors(BasicBlock *BB, // if (!Preds.empty()) { // Is the loop not obviously dead? for (BasicBlock::iterator I = BB->begin(); - PHINode *PN = dyn_cast(&*I); ++I) { + PHINode *PN = dyn_cast(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 @@ BasicBlock *Preheaders::SplitBlockPredecessors(BasicBlock *BB, } else { // Otherwise the loop is dead... for (BasicBlock::iterator I = BB->begin(); - PHINode *PN = dyn_cast(&*I); ++I) + PHINode *PN = dyn_cast(I); ++I) // Insert dummy values as the incoming value... PN->addIncoming(Constant::getNullValue(PN->getType()), NewBB); } diff --git a/lib/Transforms/Scalar/LowerAllocations.cpp b/lib/Transforms/Scalar/LowerAllocations.cpp index 0148134d03b..68fb74efaf6 100644 --- a/lib/Transforms/Scalar/LowerAllocations.cpp +++ b/lib/Transforms/Scalar/LowerAllocations.cpp @@ -85,7 +85,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { // 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(&*I)) { + if (MallocInst *MI = dyn_cast(I)) { const Type *AllocTy = MI->getType()->getElementType(); // Get the number of bytes to be allocated for one element of the @@ -114,7 +114,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { I = --BBIL.erase(I); // remove and delete the malloc instr... Changed = true; ++NumLowered; - } else if (FreeInst *FI = dyn_cast(&*I)) { + } else if (FreeInst *FI = dyn_cast(I)) { // Cast the argument to free into a ubyte*... CastInst *MCast = new CastInst(FI->getOperand(0), PointerType::get(Type::UByteTy), "", I); diff --git a/lib/Transforms/Scalar/Mem2Reg.cpp b/lib/Transforms/Scalar/Mem2Reg.cpp index 848c4d67066..6bd859a4037 100644 --- a/lib/Transforms/Scalar/Mem2Reg.cpp +++ b/lib/Transforms/Scalar/Mem2Reg.cpp @@ -43,7 +43,7 @@ bool PromotePass::runOnFunction(Function &F) { // 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(&*I)) // Is it an alloca? + if (AllocaInst *AI = dyn_cast(I)) // Is it an alloca? if (isAllocaPromotable(AI, TD)) Allocas.push_back(AI); diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index df0a64188f3..3414c410ac8 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -224,7 +224,7 @@ bool Reassociate::ReassociateBB(BasicBlock *BB) { // the two operands are sorted incorrectly, fix it now. // if (BI->isAssociative()) { - BinaryOperator *I = cast(&*BI); + BinaryOperator *I = cast(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 diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 66818bc3b63..77b41f4e360 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -474,7 +474,7 @@ void SCCP::visitTerminatorInst(TerminatorInst &TI) { // constant now may not be. // for (BasicBlock::iterator I = Succ->begin(); - PHINode *PN = dyn_cast(&*I); ++I) + PHINode *PN = dyn_cast(I); ++I) visitPHINode(*PN); } } diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp index c44f9d324ec..a87dbce2a09 100644 --- a/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -85,7 +85,7 @@ void SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) { // merge incoming values from NewBB instead of from TIBB. // for (BasicBlock::iterator I = DestBB->begin(); - PHINode *PN = dyn_cast(&*I); ++I) { + PHINode *PN = dyn_cast(I); ++I) { // We no longer enter through TIBB, now we come in through NewBB. PN->replaceUsesOfWith(TIBB, NewBB); } diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 25d835684b2..e1910446de2 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -40,7 +40,7 @@ static bool PropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { // 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) { + PHINode *PN = dyn_cast(I); ++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 @@ -56,7 +56,7 @@ static bool PropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { // Loop over all of the PHI nodes in the successor BB for (BasicBlock::iterator I = Succ->begin(); - PHINode *PN = dyn_cast(&*I); ++I) { + PHINode *PN = dyn_cast(I); ++I) { Value *OldVal = PN->removeIncomingValue(BB, false); assert(OldVal && "No entry in PHI for Pred BB!"); diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 89f9a27f8da..04f4e1cfc0d 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -196,7 +196,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred) { } else { // Okay, now we know that we need to remove predecessor #pred_idx from all // PHI nodes. Iterate over each PHI node fixing them up - for (iterator II = begin(); PHINode *PN = dyn_cast(&*II); ++II) + for (iterator II = begin(); PHINode *PN = dyn_cast(II); ++II) PN->removeIncomingValue(Pred); } } @@ -243,7 +243,7 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I) { // incoming values... BasicBlock *Successor = *I; for (BasicBlock::iterator II = Successor->begin(); - PHINode *PN = dyn_cast(&*II); ++II) { + PHINode *PN = dyn_cast(II); ++II) { int IDX = PN->getBasicBlockIndex(this); while (IDX != -1) { PN->setIncomingBlock((unsigned)IDX, New);