Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RISCV][LTO] Enable LTO #18

Merged
merged 6 commits into from
Aug 3, 2021
Merged

[RISCV][LTO] Enable LTO #18

merged 6 commits into from
Aug 3, 2021

Conversation

huettern
Copy link

@huettern huettern commented Jun 30, 2021

Based on the two patches https://reviews.llvm.org/D78035 and https://reviews.llvm.org/D72624 this PR aims at enabling LTO for RISCV.

Working

Not Working

  • The ELF emitted by llvm-lto misses the 0x4, double-float ABI flags which causes the second link step (that links the code with the crt0 in my test case) to fail due to different ABI. This should be addressed by the two patches but does not seem to work for the emitted ELF. The intermediate steps during LTO do have the correct ABI parsed from the IR metadata

    Fixed in 6e01505

ToDo

  • Test cases
    • LTO/ThinLTO and their different APIs
      partially done in 6c529fc
    • gold plugin tests: This requires a gold linker with elf32lriscv emulation

@huettern
Copy link
Author

huettern commented Jun 30, 2021

[BOT] C-source lint diff for 5c08ac888793bbdf278494f0f973afe658081fe8 available here

[BOT] C-source lint diff for af81f653b4f9d83d761413076dd423ce366f30e0 available here
[BOT] C-source lint diff for 0c495b6fac6c10bacfa1a75df6c65b563b15911a available here
[BOT] C-source lint diff for 1b123dedb1daf6a95c2708d727cf4035c0372936 available here

@huettern
Copy link
Author

huettern commented Jul 2, 2021

New effort has been made in upstream LLVM to parse the metadata in RISCV. D102582 does the necessary metadata parsing and D71387 then enables LTO.

Discussion on the mailing list: https://lists.llvm.org/pipermail/llvm-dev/2021-July/151587.html

@huettern huettern marked this pull request as ready for review August 3, 2021 11:18
@huettern huettern mentioned this pull request Aug 3, 2021
@huettern huettern merged commit f4006b0 into snitch Aug 3, 2021
@huettern huettern deleted the lto branch August 3, 2021 11:20
huettern added a commit that referenced this pull request Aug 11, 2021
* [LLVM] D72624 TargetMachine Hook for Module Metadata

* [RISCV][LTO] enable LTO/ThinLTO on RISCV (D78035)

* [LTO] Pass Module to TMFactory to correctly set-up ABI

* [LLVM] disable assertion for in set options

* [RISCV] LTO tests

* [RISCV] gold/LTO mixed thin/regular test
pulp-bot pushed a commit that referenced this pull request Sep 4, 2021
* [LLVM] D72624 TargetMachine Hook for Module Metadata

* [RISCV][LTO] enable LTO/ThinLTO on RISCV (D78035)

* [LTO] Pass Module to TMFactory to correctly set-up ABI

* [LLVM] disable assertion for in set options

* [RISCV] LTO tests

* [RISCV] gold/LTO mixed thin/regular test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant