[PATCH] D129893: extending code layout alg
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 12:20:59 PDT 2022
wenlei added a comment.
lgtm with a few nits.
================
Comment at: llvm/lib/Transforms/Utils/CodeLayout.cpp:514
// Initialize jumps between blocks
SuccNodes = std::vector<std::vector<uint64_t>>(NumNodes);
PredNodes = std::vector<std::vector<uint64_t>>(NumNodes);
----------------
nit: `SuccNodes.resize(NumNodes)` should just work, so you don't invoke copy/move constructor here. Same for `PredNodes`.
================
Comment at: llvm/lib/Transforms/Utils/CodeLayout.cpp:516
PredNodes = std::vector<std::vector<uint64_t>>(NumNodes);
+ auto OutDegree = std::vector<uint64_t>(NumNodes, 0);
AllJumps.reserve(EdgeCounts.size());
----------------
nit: `std::vector<uint64_t> OutDegree(NumNodes, 0);` this is avoids copy/move constructor from the temp object.
Same for the other `auto OutDegree` and other instances of `auto xx = std::vector<..>`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129893/new/
https://reviews.llvm.org/D129893
More information about the llvm-commits
mailing list