[PATCH] D71182: [NFC][llvm][MIRVRegNamerUtils] Making some stylistic changes to MIRVRegNamerUtils.cpp

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 11:57:32 PST 2019


aditya_nandakumar added inline comments.


================
Comment at: llvm/lib/CodeGen/MIRVRegNamerUtils.cpp:28
+                    [](MachineOperand &MO) { return &MO; });
+    Changed = Changed || RenameMOs.size();
 
----------------
I honestly don't think this is actually making this code easier to read (or modernizing) compared to the push_back (there's back_inserter, transform with lambda) compared to a simple one liner for loop. Maybe you want std::copy with the backinserter - but even that I'm conflicted on readability compared to a simple for loop here.


================
Comment at: llvm/lib/CodeGen/MIRVRegNamerUtils.cpp:90
+      MI.uses(), std::back_inserter(MIOperands),
+      [&HashOperand](const MachineOperand &MO) { return HashOperand(MO); });
   auto HashMI = hash_combine_range(MIOperands.begin(), MIOperands.end());
----------------
Again I find the for loop easy to read and the std::transform use case not so much.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71182/new/

https://reviews.llvm.org/D71182





More information about the llvm-commits mailing list