[PATCH] D144368: use transfer by reference instead of value to make some space more efficient

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 01:29:21 PST 2023


XinWang10 created this revision.
Herald added subscribers: mtrofin, hiraditya, qcolombet, MatzeB.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I hi


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144368

Files:
  llvm/include/llvm/Object/ELF.h
  llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp


Index: llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
===================================================================
--- llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
+++ llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
@@ -892,7 +892,7 @@
     NrRematerializable += LIFC.IsRemat;
 
     if (EnableDevelopmentFeatures) {
-      for (auto CurrentSegment : LI) {
+      for (auto &CurrentSegment : LI) {
         LRPosInfo.push_back(
             LRStartEndInfo{CurrentSegment.start, CurrentSegment.end, Pos});
       }
Index: llvm/include/llvm/Object/ELF.h
===================================================================
--- llvm/include/llvm/Object/ELF.h
+++ llvm/include/llvm/Object/ELF.h
@@ -776,7 +776,7 @@
     return;
 
   FakeSectionStrings += '\0';
-  for (auto [Idx, Phdr] : llvm::enumerate(*PhdrsOrErr)) {
+  for (auto& [Idx, Phdr] : llvm::enumerate(*PhdrsOrErr)) {
     if (Phdr.p_type != ELF::PT_LOAD || !(Phdr.p_flags & ELF::PF_X))
       continue;
     Elf_Shdr FakeShdr = {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144368.498762.patch
Type: text/x-patch
Size: 989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230220/6e60adbc/attachment.bin>


More information about the llvm-commits mailing list