[PATCH] D104976: [AsmWriter] Properly handle uselistorder for global symbols

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 26 07:22:23 PDT 2021


nikic created this revision.
nikic added reviewers: dexonsmith, opaque-pointers.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, AsmWriter will stick uselistorder directives for global values inside individual functions. This doesn't make a lot of sense, and interacts badly with D104950 <https://reviews.llvm.org/D104950>, as use list order adjustments will be performed while still working on a forward reference.

This patch instead always prints uselistorder directives for globals at the module level. This isn't really compatible with the previously used implementation approach. Rather than walking through all values again, use the OrderMap (after stabilizing its order) to go through all values and compute the use list shuffles for them. Classify them per-function, or nullptr for globals.

Even independently of D104950 <https://reviews.llvm.org/D104950>, this seems to fix a few verify-uselistorder failures. Conveniently, there is even a pre-existing failing test that this fixes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104976

Files:
  llvm/lib/IR/AsmWriter.cpp
  llvm/test/Bitcode/use-list-order2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104976.354673.patch
Type: text/x-patch
Size: 10807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210626/89e23ed0/attachment.bin>


More information about the llvm-commits mailing list