[PATCH] D133026: [DeadArgElim] Use structure bindings in foreach loops. NFC

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 08:10:30 PDT 2022


psamolysov created this revision.
psamolysov added reviewers: dblaikie, RamNalamothu, MaskRay, nlopes.
psamolysov added a project: LLVM.
Herald added subscribers: ormris, StephenFan, hiraditya.
Herald added a project: All.
psamolysov requested review of this revision.
Herald added a subscriber: llvm-commits.

Since LLVM supports C++17, new features from the standard such as structure binding can be used in the source code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133026

Files:
  llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp


Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
===================================================================
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -238,8 +238,8 @@
   // Clone metadata from the old function, including debug info descriptor.
   SmallVector<std::pair<unsigned, MDNode *>, 1> MDs;
   F.getAllMetadata(MDs);
-  for (auto MD : MDs)
-    NF->addMetadata(MD.first, *MD.second);
+  for (auto [KindID, Node] : MDs)
+    NF->addMetadata(KindID, *Node);
 
   // Fix up any BlockAddresses that refer to the function.
   F.replaceAllUsesWith(ConstantExpr::getBitCast(NF, F.getType()));
@@ -1062,8 +1062,8 @@
   // Clone metadata from the old function, including debug info descriptor.
   SmallVector<std::pair<unsigned, MDNode *>, 1> MDs;
   F->getAllMetadata(MDs);
-  for (auto MD : MDs)
-    NF->addMetadata(MD.first, *MD.second);
+  for (auto [KindID, Node] : MDs)
+    NF->addMetadata(KindID, *Node);
 
   // If either the return value(s) or argument(s) are removed, then probably the
   // function does not follow standard calling conventions anymore. Hence, add


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133026.456963.patch
Type: text/x-patch
Size: 1168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220831/99f0132b/attachment.bin>


More information about the llvm-commits mailing list