This is an archive of the discontinued LLVM Phabricator instance.

[JITLink] Unify x86-64 MachO and ELF 's optimize GOT/Stub function
ClosedPublic

Authored by StephenFan on Aug 13 2021, 4:00 AM.

Details

Summary

This patch unify optimizeELF_x86_64_GOTAndStubs and optimizeMachO_x86_64_GOTAndStubs into a pure optimize_x86_64_GOTAndStubs

Diff Detail

Unit TestsFailed

Event Timeline

StephenFan created this revision.Aug 13 2021, 4:00 AM
StephenFan requested review of this revision.Aug 13 2021, 4:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2021, 4:00 AM
StephenFan edited the summary of this revision. (Show Details)Aug 13 2021, 4:04 AM
StephenFan added a reviewer: lhames.

Hi Stephen,

Please address the inline comments before committing. Otherwise LGTM. Thank you very much for this work!

  • Lang.
llvm/lib/ExecutionEngine/JITLink/x86_64.cpp
80–83

This should assert, rather than silently continuing -- a graph with an invalid edge is malformed.

96–97

This can use the x86_64::isInRangeForImmS32 function now (the original optimize functions predate the utility, which is why it wasn't used before).

109

This should use x86_64::getEdgeKindName(E.getKind()).

131–132

This can also use isInRangeForImmS32.

137

This should also use x86_64::getEdgeKindName(E.getKind()).

lhames accepted this revision.Aug 13 2021, 10:14 PM
This revision is now accepted and ready to land.Aug 13 2021, 10:14 PM

Stephen and I discussed this further on discord and realized that some generic x86-64 edge kinds needed to be renamed to avoid confusion (ELF allows several relaxations that aren't possible in MachO).

The necessary renames have been made in 632135acae2 and 27ea3f16072.

Stephen -- You'll need to rebase to account for the renames, but otherwise this should be good to land now.

This revision was landed with ongoing or failed builds.Aug 14 2021, 9:33 AM
This revision was automatically updated to reflect the committed changes.

LGTM. Thanks Stephen!