This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Simplify internalize logic. NFC
ClosedPublic

Authored by MaskRay on Aug 27 2023, 12:03 AM.

Details

Summary

D151965 removed incorrect internalization for {linkonce,weak}{,_odr} when
the prevailing copy is in native code. The multiple conditions are based
on negative conditions, which can be simplified to be based on positive cases:

  • an object with an external linkage (must be prevailing) can be internalized
  • a prevailing object with a {linkonce,weak}{,_odr} or common linkage can be internalized.

Further, the lengthy comment is a bit misleading, as it doesn't say that
objects with an external/linkonce/weak linkage can be internalized.
Clarify it.

Add non-odr weak/linkonce tests to weak_resolution.ll to improve
coverage.

Diff Detail

Unit TestsFailed

Event Timeline

MaskRay created this revision.Aug 27 2023, 12:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2023, 12:03 AM
MaskRay requested review of this revision.Aug 27 2023, 12:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2023, 12:03 AM
tejohnson accepted this revision.Aug 28 2023, 9:12 AM

Thanks for cleaning this up, I agree it is easier to follow with the restructuring. lgtm.

llvm/lib/LTO/LTO.cpp
472

Nit: remove braces

This revision is now accepted and ready to land.Aug 28 2023, 9:12 AM
MaskRay marked an inline comment as done.Aug 28 2023, 9:49 AM
MaskRay added inline comments.
llvm/lib/LTO/LTO.cpp
472

Ah, there are two statements in the body (with one continue;):)

MaskRay marked an inline comment as done.Aug 28 2023, 9:54 AM
tejohnson added inline comments.Aug 28 2023, 9:56 AM
llvm/lib/LTO/LTO.cpp
472

Woops, somehow I overlooked that line given the spacing in Phabricator. Nvm

This revision was landed with ongoing or failed builds.Aug 28 2023, 10:03 AM
This revision was automatically updated to reflect the committed changes.