[llvm] 6a0ed57 - ImplicitNullChecks.cpp - use auto const& iterators in for-range loops to avoid copies. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 09:44:03 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-21T17:42:57+01:00
New Revision: 6a0ed57a2259263d4f5923ff5c61850b8a731322
URL: https://github.com/llvm/llvm-project/commit/6a0ed57a2259263d4f5923ff5c61850b8a731322
DIFF: https://github.com/llvm/llvm-project/commit/6a0ed57a2259263d4f5923ff5c61850b8a731322.diff
LOG: ImplicitNullChecks.cpp - use auto const& iterators in for-range loops to avoid copies. NFCI.
Added:
Modified:
llvm/lib/CodeGen/ImplicitNullChecks.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp
index c2b764e5580c..65728adfeb0c 100644
--- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp
+++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp
@@ -208,7 +208,7 @@ class ImplicitNullChecks : public MachineFunctionPass {
/// Return true if \p FaultingMI can be hoisted from after the
/// instructions in \p InstsSeenSoFar to before them. Set \p Dependence to a
- /// non-null value if we also need to (and legally can) hoist a depedency.
+ /// non-null value if we also need to (and legally can) hoist a dependency.
bool canHoistInst(MachineInstr *FaultingMI,
ArrayRef<MachineInstr *> InstsSeenSoFar,
MachineBasicBlock *NullSucc, MachineInstr *&Dependence);
@@ -281,12 +281,12 @@ bool ImplicitNullChecks::canReorder(const MachineInstr *A,
// between A and B here -- for instance, we should not be dealing with heap
// load-store dependencies here.
- for (auto MOA : A->operands()) {
+ for (const auto &MOA : A->operands()) {
if (!(MOA.isReg() && MOA.getReg()))
continue;
Register RegA = MOA.getReg();
- for (auto MOB : B->operands()) {
+ for (const auto &MOB : B->operands()) {
if (!(MOB.isReg() && MOB.getReg()))
continue;
@@ -413,7 +413,7 @@ ImplicitNullChecks::isSuitableMemoryOp(const MachineInstr &MI,
bool ImplicitNullChecks::canDependenceHoistingClobberLiveIns(
MachineInstr *DependenceMI, MachineBasicBlock *NullSucc) {
- for (auto &DependenceMO : DependenceMI->operands()) {
+ for (const auto &DependenceMO : DependenceMI->operands()) {
if (!(DependenceMO.isReg() && DependenceMO.getReg()))
continue;
More information about the llvm-commits
mailing list