[PATCH] D125278: [GlobalOpt] Relax the check for ctor priorities

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 02:22:06 PDT 2022


alexander-shaposhnikov marked 2 inline comments as done.
alexander-shaposhnikov added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/CtorUtils.cpp:129
+  std::vector<size_t> CtorsByPriority(Ctors.size());
+  std::iota(CtorsByPriority.begin(), CtorsByPriority.end(), 0);
+  stable_sort(CtorsByPriority, [&](size_t LHS, size_t RHS) {
----------------
nikic wrote:
> Why does this sort CtorsByPriority rather than sorting Ctors directly?
"removeGlobalCtors" expects a BitVector (for the second argument) and it should match the (original) order of constructors.
P.S. I've considered changing that but it appears to involve more changes / kind of orthogonal to this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125278



More information about the llvm-commits mailing list