diff options
author | Kazu Hirata <kazu@google.com> | 2024-09-13 10:04:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 10:04:33 -0700 |
commit | b9d85b1263efa8c4953f8cf10999ee165f32922e (patch) | |
tree | 0e992d6c81d29d560bb781a855ec8d26739351fb /llvm/lib/CodeGen/MachineCopyPropagation.cpp | |
parent | 02e4186d0b3508e79d78b0ec844518b13a3fe9ea (diff) | |
download | llvm-b9d85b1263efa8c4953f8cf10999ee165f32922e.zip llvm-b9d85b1263efa8c4953f8cf10999ee165f32922e.tar.gz llvm-b9d85b1263efa8c4953f8cf10999ee165f32922e.tar.bz2 |
[CodeGen] Use DenseMap::operator[] (NFC) (#108489)
Once we modernize CopyInfo with default member initializations,
Copies.insert({Unit, ...})
becomes equivalent to:
Copies.try_emplace(Unit)
which we can simplify further down to Copies[Unit].
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineCopyPropagation.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp index fab36f4..8bcc437 100644 --- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp +++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp @@ -108,9 +108,10 @@ static std::optional<DestSourcePair> isCopyInstr(const MachineInstr &MI, class CopyTracker { struct CopyInfo { - MachineInstr *MI, *LastSeenUseInCopy; + MachineInstr *MI = nullptr; + MachineInstr *LastSeenUseInCopy = nullptr; SmallVector<MCRegister, 4> DefRegs; - bool Avail; + bool Avail = false; }; DenseMap<MCRegUnit, CopyInfo> Copies; @@ -240,8 +241,7 @@ public: // Remember source that's copied to Def. Once it's clobbered, then // it's no longer available for copy propagation. for (MCRegUnit Unit : TRI.regunits(Src)) { - auto I = Copies.insert({Unit, {nullptr, nullptr, {}, false}}); - auto &Copy = I.first->second; + auto &Copy = Copies[Unit]; if (!is_contained(Copy.DefRegs, Def)) Copy.DefRegs.push_back(Def); Copy.LastSeenUseInCopy = MI; |