[PATCH] D90457: [clang][driver] Set LTO mode based on input files

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 23:56:58 PST 2020


MaskRay added a comment.

Is the motivation just to avoid -flto or -flto=lto at link time? I am afraid that the advantage probably is not large enough to justify the potentially costly object file parsing in the driver. Before this, as I understand it, object files are opaque to the driver. The driver just passes all file names to the linker. With this change, every object file will be opened and `llvm::getBitcodeFileContents` will be called on every object file.



================
Comment at: clang/lib/Driver/Driver.cpp:1205
 
+  setLTOModeFromInputFiles(&Inputs);
+
----------------
On line 1133, there is a similar setLTOMode. If we are going to add the logic, probably consider unifying the logic. However, I am concerned with the cost, see my main comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90457/new/

https://reviews.llvm.org/D90457



More information about the cfe-commits mailing list