[PATCH] D15600: AArch64: Add option to use shared epilogues in compiler-rt

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 02:36:56 PST 2016


kristof.beyls added a comment.

In http://reviews.llvm.org/D15600#324957, @MatzeB wrote:

> I looked into producing comdat functions and unfortunately I am not sure we can easily do this at the moment. All the codegen passes and the usual CodeGen/Passes.cpp pipeline is built from (Machine)FunctionPasses which are not allowed to create additional functions. I don't see an easy way out there yet.
>
> As for keeping the epilogues in compiler-rt: I do not see how this case is any worse than anything else we have in compiler-rt; If you link with an incompatible/older version there is always a chance that things won't work, this should be the same for epilogues as for example soft-float intrinsics.
>
> To avoid people accidentally changing the epilogue function I decidedly choose names that pretty much completely describe the content of the epilogue function: __epilogue_X19_X20_X21_X22 does what you would expect it to do: restore X19,X10,X21 and X22 in that order and return, I don't see how anyone would change the content of that function without also choosing a different function name.


Hi Matthias,

My main objection is around requiring people to use compiler-rt as the run-time library.
Right now, it isn't required to use compiler-rt as the run-time library. E.g. on linux, often libgcc is used as the run-time library.
Sure, for some features, off-by-default, compiler-rt is required, like the sanitizers. But then users explicitly opt-in by a command line option.
I'm assuming the goal is that these shared epilogues-generation will be on by-default. Users on systems linking against the libgcc run-time library will all of a sudden see link failures, without having opted in for a particular feature.
If the right solution would be for these functions to be in all AArch64-supporting run-time libraries, then these ought to be defined in the AArch64 run-time library ABI, which would take quite a bit of time and effort.

In short, I think there are 2 practical ways forward:

1. Only enable shared epilogues-generation on platforms that already demand using compiler-rt as the run-time library. I'm guessing that is Darwin-based platforms, but probably not much else?
2. As suggested by Renato in a previous comment, add a pass early enough in the pipeline so it can add functions, to add the function definitions for all of the shared epilogues. Even if some of the shared epilogues aren't used in the translation unit, or in  the finally linked program, that's OK: the linker should eliminate those. The drawback is that object files will be slightly larger. The advantage is that this should work on all platforms.

All-in-all, with the limited knowledge I have of all the details involved, I prefer option 2 if possible.


Repository:
  rL LLVM

http://reviews.llvm.org/D15600





More information about the llvm-commits mailing list