This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add option to control PCRel GOT indirect linker optimization
ClosedPublic

Authored by stefanp on Aug 5 2020, 5:01 PM.

Details

Summary

Add a hidden option to the compiler to control a the PC Relative GOT indirect
linker optimization.

If this option is set to false the compiler will no loger produce the
relocations required by the linker to perform the optimization.

Diff Detail

Event Timeline

stefanp created this revision.Aug 5 2020, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2020, 5:01 PM
stefanp requested review of this revision.Aug 5 2020, 5:01 PM
stefanp added a reviewer: Restricted Project.Aug 5 2020, 5:03 PM

Overall LGTM. I only have some nits comment/question for the test case and clang-format related issue.

llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
42

nit: clang-format

llvm/test/CodeGen/PowerPC/pcrel-linkeropt-option.ll
4

nit: can we use -mcpu=pwr10 here?

7

ditto

10

ditto

15

nit: Do we need to keep #0 and attributes #0 = { nounwind } below?

nemanjai accepted this revision.Aug 7 2020, 5:12 AM

I agree with Victor, please remove uses of future and use pwr10. All of this can be addressed when committing - another round of review is not required. LGTM.

llvm/test/CodeGen/PowerPC/pcrel-linkeropt-option.ll
15

Yeah, this doesn't get a stack frame so we gain nothing by having this. Please remove it in this case.

This revision is now accepted and ready to land.Aug 7 2020, 5:12 AM
stefanp updated this revision to Diff 283931.Aug 7 2020, 9:37 AM

Fixed the mcpu=future to make it mcpu=pwr10.

stefanp updated this revision to Diff 283932.Aug 7 2020, 9:41 AM

Removed the attribute nounwind as it is not needed in the test case.

llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
42

I would rather not do clang-format here. I want to have this option look the same as the other one after it.

I can clang-format both options in an NFC patch later.

llvm/test/CodeGen/PowerPC/pcrel-linkeropt-option.ll
4

Thank you for catching that.
That's a copy-paste. :)

NeHuang accepted this revision.Aug 7 2020, 12:29 PM

Thanks! LGTM.

This revision was landed with ongoing or failed builds.Aug 10 2020, 7:07 AM
This revision was automatically updated to reflect the committed changes.