Skip to content

Commit 6a0ed57

Browse files
committed
ImplicitNullChecks.cpp - use auto const& iterators in for-range loops to avoid copies. NFCI.
1 parent 3cbdfe4 commit 6a0ed57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/CodeGen/ImplicitNullChecks.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class ImplicitNullChecks : public MachineFunctionPass {
208208

209209
/// Return true if \p FaultingMI can be hoisted from after the
210210
/// instructions in \p InstsSeenSoFar to before them. Set \p Dependence to a
211-
/// non-null value if we also need to (and legally can) hoist a depedency.
211+
/// non-null value if we also need to (and legally can) hoist a dependency.
212212
bool canHoistInst(MachineInstr *FaultingMI,
213213
ArrayRef<MachineInstr *> InstsSeenSoFar,
214214
MachineBasicBlock *NullSucc, MachineInstr *&Dependence);
@@ -281,12 +281,12 @@ bool ImplicitNullChecks::canReorder(const MachineInstr *A,
281281
// between A and B here -- for instance, we should not be dealing with heap
282282
// load-store dependencies here.
283283

284-
for (auto MOA : A->operands()) {
284+
for (const auto &MOA : A->operands()) {
285285
if (!(MOA.isReg() && MOA.getReg()))
286286
continue;
287287

288288
Register RegA = MOA.getReg();
289-
for (auto MOB : B->operands()) {
289+
for (const auto &MOB : B->operands()) {
290290
if (!(MOB.isReg() && MOB.getReg()))
291291
continue;
292292

@@ -413,7 +413,7 @@ ImplicitNullChecks::isSuitableMemoryOp(const MachineInstr &MI,
413413

414414
bool ImplicitNullChecks::canDependenceHoistingClobberLiveIns(
415415
MachineInstr *DependenceMI, MachineBasicBlock *NullSucc) {
416-
for (auto &DependenceMO : DependenceMI->operands()) {
416+
for (const auto &DependenceMO : DependenceMI->operands()) {
417417
if (!(DependenceMO.isReg() && DependenceMO.getReg()))
418418
continue;
419419

0 commit comments

Comments
 (0)