[llvm] Use range-based for loops with CallBase::args (NFC)

This commit is contained in:
Kazu Hirata 2021-11-14 09:32:36 -08:00
parent f86b57e37c
commit 098e935174
3 changed files with 7 additions and 7 deletions

View File

@ -171,8 +171,8 @@ bool IsPotentialRetainableObjPtr(const Value *Op, AAResults &AA);
/// Helper for GetARCInstKind. Determines what kind of construct CS /// Helper for GetARCInstKind. Determines what kind of construct CS
/// is. /// is.
inline ARCInstKind GetCallSiteClass(const CallBase &CB) { inline ARCInstKind GetCallSiteClass(const CallBase &CB) {
for (auto I = CB.arg_begin(), E = CB.arg_end(); I != E; ++I) for (const Use &U : CB.args())
if (IsPotentialRetainableObjPtr(*I)) if (IsPotentialRetainableObjPtr(U))
return CB.onlyReadsMemory() ? ARCInstKind::User : ARCInstKind::CallOrUser; return CB.onlyReadsMemory() ? ARCInstKind::User : ARCInstKind::CallOrUser;
return CB.onlyReadsMemory() ? ARCInstKind::None : ARCInstKind::Call; return CB.onlyReadsMemory() ? ARCInstKind::None : ARCInstKind::Call;

View File

@ -181,8 +181,8 @@ static MemoryAccessKind checkFunctionMemoryAccess(Function &F, bool ThisBody,
// Check whether all pointer arguments point to local memory, and // Check whether all pointer arguments point to local memory, and
// ignore calls that only access local memory. // ignore calls that only access local memory.
for (auto CI = Call->arg_begin(), CE = Call->arg_end(); CI != CE; ++CI) { for (const Use &U : Call->args()) {
Value *Arg = *CI; const Value *Arg = U;
if (!Arg->getType()->isPtrOrPtrVectorTy()) if (!Arg->getType()->isPtrOrPtrVectorTy())
continue; continue;

View File

@ -1197,10 +1197,10 @@ void SCCPInstVisitor::handleCallOverdefined(CallBase &CB) {
// a declaration, maybe we can constant fold it. // a declaration, maybe we can constant fold it.
if (F && F->isDeclaration() && canConstantFoldCallTo(&CB, F)) { if (F && F->isDeclaration() && canConstantFoldCallTo(&CB, F)) {
SmallVector<Constant *, 8> Operands; SmallVector<Constant *, 8> Operands;
for (auto AI = CB.arg_begin(), E = CB.arg_end(); AI != E; ++AI) { for (const Use &A : CB.args()) {
if (AI->get()->getType()->isStructTy()) if (A.get()->getType()->isStructTy())
return markOverdefined(&CB); // Can't handle struct args. return markOverdefined(&CB); // Can't handle struct args.
ValueLatticeElement State = getValueState(*AI); ValueLatticeElement State = getValueState(A);
if (State.isUnknownOrUndef()) if (State.isUnknownOrUndef())
return; // Operands are not resolved yet. return; // Operands are not resolved yet.