[PATCH] D45217: [ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 16 11:31:15 PDT 2018


pcc added inline comments.


================
Comment at: include/clang/Driver/Options.td:2255
   HelpText<"Save intermediate compilation results.">;
-def save_temps : Flag<["-", "--"], "save-temps">, Flags<[DriverOption]>,
+def save_temps : Flag<["-", "--"], "save-temps">, Flags<[CC1Option, DriverOption]>,
   Alias<save_temps_EQ>, AliasArgs<["cwd"]>,
----------------
tejohnson wrote:
> pcc wrote:
> > This is still just a DriverOption, right?
> No, we need to pass to cc1 to get it into the CodeGenOptions. See the changes to Clang.cpp (passes to cc1 invocation) and CompilerInvocation.cpp (consumes during cc1 invocation).
You are producing a `-save-temps=` flag, not `-save-temps`. 

i.e. I think you should be able to remove the CC1Option from this line and keep it on line 2253.


================
Comment at: test/CodeGen/thinlto_backend.ll:30
 ; Ensure f2 was imported
-; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c -fthinlto-index=%t.thinlto.bc
+; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c -fthinlto-index=%t.thinlto.bc -save-temps=obj
 ; RUN: llvm-nm %t3.o | FileCheck --check-prefix=CHECK-OBJ %s
----------------
tejohnson wrote:
> pcc wrote:
> > Should there be another test for `-save-temps=cwd`?
> Added -save-temps=cwd and -save-temps
This isn't actually testing that the behaviour is different between `-save-temps=obj` and `-save-temps=cwd`, right?

Maybe create a new directory, cd there and verify that the files are created there?


Repository:
  rC Clang

https://reviews.llvm.org/D45217





More information about the cfe-commits mailing list