This is an archive of the discontinued LLVM Phabricator instance.

[x86] Make the retpoline thunk insertion a machine function pass.
ClosedPublic

Authored by chandlerc on Jan 30 2018, 10:24 PM.

Details

Summary

This removes the need for a machine module pass using some deeply
questionable hacks. This should address PR36123 which is a case where in
full LTO the memory usage of a machine module pass actually ended up
being significant.

We should revert this on trunk as soon as we understand and fix the
memory usage issue, but we should include this in any backports of
retpolines themselves.

Diff Detail

Repository
rL LLVM

Event Timeline

chandlerc created this revision.Jan 30 2018, 10:24 PM
MatzeB added inline comments.Jan 31 2018, 10:22 AM
llvm/lib/Target/X86/X86RetpolineThunks.cpp
61 ↗(On Diff #132099)

Is this not using MachineFunctionPass::getAnalysisUsage() on purpose?

211 ↗(On Diff #132099)

Add assert(Name.startswith(ThunkNamePrefix)) as the runOnMachineFunction logic depends on it?

266 ↗(On Diff #132099)

indent

chandlerc marked 3 inline comments as done.Jan 31 2018, 11:11 AM

Thanks, applied fixes. I can update the patch if useful.

llvm/lib/Target/X86/X86RetpolineThunks.cpp
61 ↗(On Diff #132099)

No, just a drive-by mistake on my part. Should be fixed.

211 ↗(On Diff #132099)

Good idea!

chandlerc marked 2 inline comments as done.

Update with fixes from review.

MatzeB accepted this revision.Jan 31 2018, 11:16 AM

LGTM, thanks.

This revision is now accepted and ready to land.Jan 31 2018, 11:16 AM
echristo accepted this revision.Jan 31 2018, 11:40 AM

LGTM, thanks!

This revision was automatically updated to reflect the committed changes.