================
@@ -700,7 +700,12 @@ static void addSanitizers(const Triple &TargetTriple,
const CodeGenOptions &CodeGenOpts,
const LangOptions &LangOpts, PassBuilder &PB) {
auto SanitizersCallback = [&](ModulePassManager &MPM, OptimizationLevel
Level,
- ThinOrFullLTOPhase) {
+ ThinOrFullLTOPhase phase) {
+ // FatLTO pipelines already added these to the prelink pipeline.
+ if (CodeGenOpts.FatLTO &&
+ (CodeGenOpts.PrepareForThinLTO || CodeGenOpts.PrepareForLTO) &&
+ ThinOrFullLTOPhase::None != phase)
----------------
ilovepi wrote:
> Hm... I think this condition is too specific and fragile. Have you checked
> that this also works for the `-flto=thin` variant? Because I believe that one
> is going to use `ThinOrFullLTOPhase::ThinLTOPostLink` here.
>
It did test it locally with `-flto=thin`. I should have a test for those in
this patch though.
> I think the correct way to fix this is to just check for a non-post-link
> phase here (without any checks for other options) and to adjust
>
> https://github.com/llvm/llvm-project/blob/8c122e5d3bcbdd82c34a406c6d3029060306521a/llvm/lib/Passes/PassBuilderPipelines.cpp#L1727
>
> to pass one of the post-link phases.
So use the postlink phase to finish the compile? We could try that, but 1) I
thought you were opposed to it. 2) I'm a little concerned there are things in
the post link pipelines that won't generate nice object files for a single TU.
For instance, we drop most of the WPD metadata after the prelink pipelines
run, but since the default module optimization doesn't run WPD passes, if
anything is missed, it doesn't end up having an effect on the object code under
Full LTO. Under ThinLTO we have some remaining issues like
https://github.com/llvm/llvm-project/issues/139440, where the prelink pipeline
starts modifying the vtables, and the normal module optimization goes awry.
There we tried to just go back to cloning the modules, but #139999 introduced
other regressions. Using the post link pipeline instead, I think would make
both pipelines subtly wrong under WPD, whereas today WPD works fine under
FullLTO w/ -fat-lto-objects.
I can give the postlink piplines a try and see how it goes in Fuchsia builds.
That should give us a little confidence that its not 100% broken.
https://github.com/llvm/llvm-project/pull/160213
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits