[llvm] [mcp-frameinst: 1/3]: [MCP][NFC] Cleanup and prepare to preserve frame-setup/destroy (PR #186240)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 13:55:17 PDT 2026


================
@@ -226,10 +223,10 @@ class CopyTracker {
           if (SrcCopy != Copies.end() && SrcCopy->second.LastSeenUseInCopy) {
             // If SrcCopy defines multiple values, we only need
             // to erase the record for Def in DefRegs.
-            for (auto itr = SrcCopy->second.DefRegs.begin();
-                 itr != SrcCopy->second.DefRegs.end(); itr++) {
-              if (*itr == Def) {
-                SrcCopy->second.DefRegs.erase(itr);
+            for (auto *Itr = SrcCopy->second.DefRegs.begin();
----------------
s-barannikov wrote:

It is because it "knows" that the iterator is just a pointer. If we change the iterator to something more sophisticated, the code will not compile.
And FWIW I'm also annoyed by this clang-tidy check.


https://github.com/llvm/llvm-project/pull/186240


More information about the llvm-commits mailing list