[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
/// is.
inline ARCInstKind GetCallSiteClass(const CallBase &CB) {
for (auto I = CB.arg_begin(), E = CB.arg_end(); I != E; ++I)
if (IsPotentialRetainableObjPtr(*I))
for (const Use &U : CB.args())
if (IsPotentialRetainableObjPtr(U))
return CB.onlyReadsMemory() ? ARCInstKind::User : ARCInstKind::CallOrUser;
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
// ignore calls that only access local memory.
for (auto CI = Call->arg_begin(), CE = Call->arg_end(); CI != CE; ++CI) {
Value *Arg = *CI;
for (const Use &U : Call->args()) {
const Value *Arg = U;
if (!Arg->getType()->isPtrOrPtrVectorTy())
continue;

View File

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