[lld] [lld][macho] Restructure thunk generation algorithm (PR #193367)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 04:51:29 PDT 2026


================
@@ -228,13 +223,15 @@ void TextOutputSection::finalize() {
   const uint64_t slop = config->slopScale * target->thunkSize;
   for (auto *isec : inputs) {
     while (!branchesToProcess.empty()) {
-      auto &[callerIsec, r, thunkKey] = branchesToProcess.front();
+      auto [callerIsec, r] = branchesToProcess.front();
       assert(callerIsec->isFinal);
+      auto *funcSym = cast<Symbol *>(r->referent);
----------------
nocchijiang wrote:

nit: the repeated `funcSym` temporary feels a bit noisy especially since it's usually only used to construct the `ThunkKey`. Could we hide the key construction behind a small helper?

https://github.com/llvm/llvm-project/pull/193367


More information about the llvm-commits mailing list