[PATCH] D146876: [ThinLTO] Only import for non-prevailing interposable global variables

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 25 09:26:33 PDT 2023


smeenai created this revision.
smeenai added a reviewer: tejohnson.
Herald added subscribers: ormris, steven_wu, hiraditya, inglorion.
Herald added a project: All.
smeenai requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This logic was added in https://reviews.llvm.org/D95943 specifically to
handle an issue for non-prevailing global variables. It turns out that
it adds a new issue for prevailing glboal variables, since those could
be replaced by an available_externally definition and hence incorrectly
omitted from the output object file. Limit the import to non-prevailing
global variables to fix this, as suggested by @tejohnson.

The bulk of the diff is mechanical changes to thread isPrevailing
through to where it's needed and ensure it's available before the
relevant calls; the actual logic change itself is straightforward.

Fixes https://github.com/llvm/llvm-project/issues/61677


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146876

Files:
  llvm/include/llvm/Transforms/IPO/FunctionImport.h
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp
  llvm/lib/Transforms/IPO/FunctionImport.cpp
  llvm/test/ThinLTO/X86/nonprevailing_weak_globals_import.ll
  llvm/test/ThinLTO/X86/prevailing_weak_globals_import.ll
  llvm/test/ThinLTO/X86/weak_globals_import.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146876.508317.patch
Type: text/x-patch
Size: 20288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230325/03cff509/attachment.bin>


More information about the llvm-commits mailing list