[PATCH] D33112: Optimize orphan plament in a general way
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 11 17:38:56 PDT 2017
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: ELF/Writer.cpp:653-654
+ // can start assigning VA starting from them later.
+ auto AddrSetI = Config->SectionStartMap.find(Sec->Name);
+ if (AddrSetI != Config->SectionStartMap.end())
+ return Rank;
----------------
You can use `.count()` instead of `.find()`.
================
Comment at: ELF/Writer.cpp:667-668
+ if (!(Sec->Flags & SHF_ALLOC)) {
+ Rank |= RF_NOT_ALLOC;
+ return Rank;
+ }
----------------
You can return `Rank | RF_NOT_ALLOC`
================
Comment at: ELF/Writer.cpp:762-763
+ if (!(A->SortRank & RF_NOT_ADDR_SET)) {
+ auto AAddrSetI = Config->SectionStartMap.find(A->Name);
+ auto BAddrSetI = Config->SectionStartMap.find(B->Name);
+ return AAddrSetI->second < BAddrSetI->second;
----------------
Can you use `at` instead of `find`?
https://reviews.llvm.org/D33112
More information about the llvm-commits
mailing list