Skip to content

Commit 71b89b1

Browse files
committed
LoopAccessAnalysis.cpp - use const reference in for-range loops. NFCI.
1 parent bb448a2 commit 71b89b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
730730
// First, count how many write and read accesses are in the alias set. Also
731731
// collect MemAccessInfos for later.
732732
SmallVector<MemAccessInfo, 4> AccessInfos;
733-
for (auto A : AS) {
733+
for (const auto &A : AS) {
734734
Value *Ptr = A.getValue();
735735
bool IsWrite = Accesses.count(MemAccessInfo(Ptr, true));
736736

@@ -864,7 +864,7 @@ void AccessAnalysis::processMemAccesses() {
864864
// compatibility and potential for underlying-object overlap. As a result, we
865865
// only need to check for potential pointer dependencies within each alias
866866
// set.
867-
for (auto &AS : AST) {
867+
for (const auto &AS : AST) {
868868
// Note that both the alias-set tracker and the alias sets themselves used
869869
// linked lists internally and so the iteration order here is deterministic
870870
// (matching the original instruction order within each set).
@@ -884,12 +884,12 @@ void AccessAnalysis::processMemAccesses() {
884884
bool UseDeferred = SetIteration > 0;
885885
PtrAccessSet &S = UseDeferred ? DeferredAccesses : Accesses;
886886

887-
for (auto AV : AS) {
887+
for (const auto &AV : AS) {
888888
Value *Ptr = AV.getValue();
889889

890890
// For a single memory access in AliasSetTracker, Accesses may contain
891891
// both read and write, and they both need to be handled for CheckDeps.
892-
for (auto AC : S) {
892+
for (const auto &AC : S) {
893893
if (AC.getPointer() != Ptr)
894894
continue;
895895

0 commit comments

Comments
 (0)