mass elimination of reliance on automatic iterator dereferencing

llvm-svn: 109103
This commit is contained in:
Gabor Greif 2010-07-22 13:36:47 +00:00
parent 0525393a79
commit dde79d8f1a
12 changed files with 18 additions and 18 deletions

View File

@ -2588,7 +2588,7 @@ PushDefUseChildren(Instruction *I,
// Push the def-use children onto the Worklist stack. // Push the def-use children onto the Worklist stack.
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); for (Value::use_iterator UI = I->use_begin(), UE = I->use_end();
UI != UE; ++UI) UI != UE; ++UI)
Worklist.push_back(cast<Instruction>(UI)); Worklist.push_back(cast<Instruction>(*UI));
} }
/// ForgetSymbolicValue - This looks up computed SCEV values for all /// ForgetSymbolicValue - This looks up computed SCEV values for all

View File

@ -144,7 +144,7 @@ namespace {
SI = 0; SI = 0;
for (Value::use_iterator for (Value::use_iterator
I = II->use_begin(), E = II->use_end(); I != E; ++I) { I = II->use_begin(), E = II->use_end(); I != E; ++I) {
SI = dyn_cast<StoreInst>(I); SI = dyn_cast<StoreInst>(*I);
if (SI) break; if (SI) break;
} }
@ -207,7 +207,7 @@ FindAllCleanupSelectors(SmallPtrSet<IntrinsicInst*, 32> &Sels,
for (Value::use_iterator for (Value::use_iterator
I = SelectorIntrinsic->use_begin(), I = SelectorIntrinsic->use_begin(),
E = SelectorIntrinsic->use_end(); I != E; ++I) { E = SelectorIntrinsic->use_end(); I != E; ++I) {
IntrinsicInst *II = cast<IntrinsicInst>(I); IntrinsicInst *II = cast<IntrinsicInst>(*I);
if (II->getParent()->getParent() != F) if (II->getParent()->getParent() != F)
continue; continue;
@ -225,7 +225,7 @@ FindAllURoRInvokes(SmallPtrSet<InvokeInst*, 32> &URoRInvokes) {
for (Value::use_iterator for (Value::use_iterator
I = URoR->use_begin(), I = URoR->use_begin(),
E = URoR->use_end(); I != E; ++I) { E = URoR->use_end(); I != E; ++I) {
if (InvokeInst *II = dyn_cast<InvokeInst>(I)) if (InvokeInst *II = dyn_cast<InvokeInst>(*I))
URoRInvokes.insert(II); URoRInvokes.insert(II);
} }
} }
@ -271,7 +271,7 @@ DwarfEHPrepare::FindSelectorAndURoR(Instruction *Inst, bool &URoRInvoke,
restart: restart:
for (Value::use_iterator for (Value::use_iterator
I = Inst->use_begin(), E = Inst->use_end(); I != E; ++I) { I = Inst->use_begin(), E = Inst->use_end(); I != E; ++I) {
Instruction *II = dyn_cast<Instruction>(I); Instruction *II = dyn_cast<Instruction>(*I);
if (!II || II->getParent()->getParent() != F) continue; if (!II || II->getParent()->getParent() != F) continue;
if (IntrinsicInst *Sel = dyn_cast<IntrinsicInst>(II)) { if (IntrinsicInst *Sel = dyn_cast<IntrinsicInst>(II)) {
@ -360,7 +360,7 @@ bool DwarfEHPrepare::HandleURoRInvokes() {
for (Value::use_iterator for (Value::use_iterator
I = ExceptionValueIntrinsic->use_begin(), I = ExceptionValueIntrinsic->use_begin(),
E = ExceptionValueIntrinsic->use_end(); I != E; ++I) { E = ExceptionValueIntrinsic->use_end(); I != E; ++I) {
IntrinsicInst *EHPtr = dyn_cast<IntrinsicInst>(I); IntrinsicInst *EHPtr = dyn_cast<IntrinsicInst>(*I);
if (!EHPtr || EHPtr->getParent()->getParent() != F) continue; if (!EHPtr || EHPtr->getParent()->getParent() != F) continue;
Changed |= PromoteEHPtrStore(EHPtr); Changed |= PromoteEHPtrStore(EHPtr);

View File

@ -94,7 +94,7 @@ bool FastISel::hasTrivialKill(const Value *V) const {
!(I->getOpcode() == Instruction::BitCast || !(I->getOpcode() == Instruction::BitCast ||
I->getOpcode() == Instruction::PtrToInt || I->getOpcode() == Instruction::PtrToInt ||
I->getOpcode() == Instruction::IntToPtr) && I->getOpcode() == Instruction::IntToPtr) &&
cast<Instruction>(I->use_begin())->getParent() == I->getParent(); cast<Instruction>(*I->use_begin())->getParent() == I->getParent();
} }
unsigned FastISel::getRegForValue(const Value *V) { unsigned FastISel::getRegForValue(const Value *V) {

View File

@ -216,7 +216,7 @@ static bool FunctionCallsSetJmp(const Function *F) {
for (Value::const_use_iterator for (Value::const_use_iterator
I = Callee->use_begin(), E = Callee->use_end(); I = Callee->use_begin(), E = Callee->use_end();
I != E; ++I) I != E; ++I)
if (const CallInst *CI = dyn_cast<CallInst>(I)) if (const CallInst *CI = dyn_cast<CallInst>(*I))
if (CI->getParent()->getParent() == F) if (CI->getParent()->getParent() == F)
return true; return true;
} }

View File

@ -187,7 +187,7 @@ bool SRETPromotion::isSafeToUpdateAllCallers(Function *F) {
return false; return false;
for (Value::use_iterator GEPI = GEP->use_begin(), GEPE = GEP->use_end(); for (Value::use_iterator GEPI = GEP->use_begin(), GEPE = GEP->use_end();
GEPI != GEPE; ++GEPI) GEPI != GEPE; ++GEPI)
if (!isa<LoadInst>(GEPI)) if (!isa<LoadInst>(*GEPI))
return false; return false;
} }
// Any other FirstArg users make this function unsuitable for sret // Any other FirstArg users make this function unsuitable for sret

View File

@ -369,7 +369,7 @@ DbgDeclareInst *InstCombiner::hasOneUsePlusDeclare(Value *V) {
if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(U)) if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(U))
return DI; return DI;
if (isa<BitCastInst>(U) && U->hasOneUse()) { if (isa<BitCastInst>(U) && U->hasOneUse()) {
if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(U->use_begin())) if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(*U->use_begin()))
return DI; return DI;
} }
} }

View File

@ -734,7 +734,7 @@ static bool isSafeReplacement(PHINode* p, Instruction *inst) {
for (Instruction::use_iterator UI = p->use_begin(), E = p->use_end(); for (Instruction::use_iterator UI = p->use_begin(), E = p->use_end();
UI != E; ++UI) UI != E; ++UI)
if (PHINode* use_phi = dyn_cast<PHINode>(UI)) if (PHINode* use_phi = dyn_cast<PHINode>(*UI))
if (use_phi->getParent() == inst->getParent()) if (use_phi->getParent() == inst->getParent())
return false; return false;

View File

@ -862,9 +862,9 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PN) {
// Check Incr uses. One user is PN and the other user is an exit condition // Check Incr uses. One user is PN and the other user is an exit condition
// used by the conditional terminator. // used by the conditional terminator.
Value::use_iterator IncrUse = Incr->use_begin(); Value::use_iterator IncrUse = Incr->use_begin();
Instruction *U1 = cast<Instruction>(IncrUse++); Instruction *U1 = cast<Instruction>(*IncrUse++);
if (IncrUse == Incr->use_end()) return; if (IncrUse == Incr->use_end()) return;
Instruction *U2 = cast<Instruction>(IncrUse++); Instruction *U2 = cast<Instruction>(*IncrUse++);
if (IncrUse != Incr->use_end()) return; if (IncrUse != Incr->use_end()) return;
// Find exit condition, which is an fcmp. If it doesn't exist, or if it isn't // Find exit condition, which is an fcmp. If it doesn't exist, or if it isn't

View File

@ -1183,7 +1183,7 @@ bool LoopIndexSplit::cleanBlock(BasicBlock *BB) {
bool usedOutsideBB = false; bool usedOutsideBB = false;
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); for (Value::use_iterator UI = I->use_begin(), UE = I->use_end();
UI != UE; ++UI) { UI != UE; ++UI) {
Instruction *U = cast<Instruction>(UI); Instruction *U = cast<Instruction>(*UI);
if (U->getParent() != BB) if (U->getParent() != BB)
usedOutsideBB = true; usedOutsideBB = true;
} }

View File

@ -532,7 +532,7 @@ struct StrStrOpt : public LibCallOptimization {
StrLen, B, TD); StrLen, B, TD);
for (Value::use_iterator UI = CI->use_begin(), UE = CI->use_end(); for (Value::use_iterator UI = CI->use_begin(), UE = CI->use_end();
UI != UE; ) { UI != UE; ) {
ICmpInst *Old = cast<ICmpInst>(UI++); ICmpInst *Old = cast<ICmpInst>(*UI++);
Value *Cmp = B.CreateICmp(Old->getPredicate(), StrNCmp, Value *Cmp = B.CreateICmp(Old->getPredicate(), StrNCmp,
ConstantInt::getNullValue(StrNCmp->getType()), ConstantInt::getNullValue(StrNCmp->getType()),
"cmp"); "cmp");

View File

@ -225,7 +225,7 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
for (Value::use_iterator UI = TIBB->use_begin(), E = TIBB->use_end(); for (Value::use_iterator UI = TIBB->use_begin(), E = TIBB->use_end();
UI != E; ) { UI != E; ) {
Value::use_iterator Use = UI++; Value::use_iterator Use = UI++;
if (PHINode *PN = dyn_cast<PHINode>(Use)) { if (PHINode *PN = dyn_cast<PHINode>(*Use)) {
// Remove one entry from each PHI. // Remove one entry from each PHI.
if (PN->getParent() == DestBB && UpdatedPHIs.insert(PN)) if (PN->getParent() == DestBB && UpdatedPHIs.insert(PN))
PN->setOperand(Use.getOperandNo(), NewBB); PN->setOperand(Use.getOperandNo(), NewBB);

View File

@ -80,12 +80,12 @@ void SSI::insertSigmaFunctions(SmallPtrSet<Instruction*, 4> &value) {
for (Value::use_iterator begin = (*I)->use_begin(), for (Value::use_iterator begin = (*I)->use_begin(),
end = (*I)->use_end(); begin != end; ++begin) { end = (*I)->use_end(); begin != end; ++begin) {
// Test if the Use of the Value is in a comparator // Test if the Use of the Value is in a comparator
if (CmpInst *CI = dyn_cast<CmpInst>(begin)) { if (CmpInst *CI = dyn_cast<CmpInst>(*begin)) {
// Iterates through all uses of CmpInst // Iterates through all uses of CmpInst
for (Value::use_iterator begin_ci = CI->use_begin(), for (Value::use_iterator begin_ci = CI->use_begin(),
end_ci = CI->use_end(); begin_ci != end_ci; ++begin_ci) { end_ci = CI->use_end(); begin_ci != end_ci; ++begin_ci) {
// Test if any use of CmpInst is in a Terminator // Test if any use of CmpInst is in a Terminator
if (TerminatorInst *TI = dyn_cast<TerminatorInst>(begin_ci)) { if (TerminatorInst *TI = dyn_cast<TerminatorInst>(*begin_ci)) {
insertSigma(TI, *I); insertSigma(TI, *I);
} }
} }