From: Bob Wilson Date: Thu, 18 Dec 2014 06:08:26 +0000 (+0000) Subject: Change -save-temps to emit unoptimized bitcode files. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23cf9d557e2396291b461c7c16a889fc97fa25a3;p=clang Change -save-temps to emit unoptimized bitcode files. It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224503 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Action.h b/include/clang/Driver/Action.h index 2739d4934d..dd0261c2f3 100644 --- a/include/clang/Driver/Action.h +++ b/include/clang/Driver/Action.h @@ -46,6 +46,7 @@ public: AnalyzeJobClass, MigrateJobClass, CompileJobClass, + BackendJobClass, AssembleJobClass, LinkJobClass, LipoJobClass, @@ -195,6 +196,16 @@ public: } }; +class BackendJobAction : public JobAction { + void anchor() override; +public: + BackendJobAction(std::unique_ptr Input, types::ID OutputType); + + static bool classof(const Action *A) { + return A->getKind() == BackendJobClass; + } +}; + class AssembleJobAction : public JobAction { void anchor() override; public: diff --git a/include/clang/Driver/Phases.h b/include/clang/Driver/Phases.h index e2160e6531..cd6b5b5c9f 100644 --- a/include/clang/Driver/Phases.h +++ b/include/clang/Driver/Phases.h @@ -19,6 +19,7 @@ namespace phases { Preprocess, Precompile, Compile, + Backend, Assemble, Link }; diff --git a/lib/Driver/Action.cpp b/lib/Driver/Action.cpp index d4f339d376..360dbeecab 100644 --- a/lib/Driver/Action.cpp +++ b/lib/Driver/Action.cpp @@ -29,6 +29,7 @@ const char *Action::getClassName(ActionClass AC) { case AnalyzeJobClass: return "analyzer"; case MigrateJobClass: return "migrator"; case CompileJobClass: return "compiler"; + case BackendJobClass: return "backend"; case AssembleJobClass: return "assembler"; case LinkJobClass: return "linker"; case LipoJobClass: return "lipo"; @@ -92,6 +93,12 @@ CompileJobAction::CompileJobAction(std::unique_ptr Input, types::ID OutputType) : JobAction(CompileJobClass, std::move(Input), OutputType) {} +void BackendJobAction::anchor() {} + +BackendJobAction::BackendJobAction(std::unique_ptr Input, + types::ID OutputType) + : JobAction(BackendJobClass, std::move(Input), OutputType) {} + void AssembleJobAction::anchor() {} AssembleJobAction::AssembleJobAction(std::unique_ptr Input, diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 99d84432de..c093ffc51a 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -165,7 +165,7 @@ const { (PhaseArg = DAL.getLastArg(options::OPT__SLASH_P))) { FinalPhase = phases::Preprocess; - // -{fsyntax-only,-analyze,emit-ast,S} only run up to the compiler. + // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler. } else if ((PhaseArg = DAL.getLastArg(options::OPT_fsyntax_only)) || (PhaseArg = DAL.getLastArg(options::OPT_module_file_info)) || (PhaseArg = DAL.getLastArg(options::OPT_verify_pch)) || @@ -174,10 +174,13 @@ const { (PhaseArg = DAL.getLastArg(options::OPT__migrate)) || (PhaseArg = DAL.getLastArg(options::OPT__analyze, options::OPT__analyze_auto)) || - (PhaseArg = DAL.getLastArg(options::OPT_emit_ast)) || - (PhaseArg = DAL.getLastArg(options::OPT_S))) { + (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) { FinalPhase = phases::Compile; + // -S only runs up to the backend. + } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) { + FinalPhase = phases::Backend; + // -c only runs up to the assembler. } else if ((PhaseArg = DAL.getLastArg(options::OPT_c))) { FinalPhase = phases::Assemble; @@ -849,7 +852,9 @@ void Driver::PrintActions(const Compilation &C) const { /// \brief Check whether the given input tree contains any compilation or /// assembly actions. static bool ContainsCompileOrAssembleAction(const Action *A) { - if (isa(A) || isa(A)) + if (isa(A) || + isa(A) || + isa(A)) return true; for (Action::const_iterator it = A->begin(), ie = A->end(); it != ie; ++it) @@ -1346,17 +1351,21 @@ Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase, if (Args.hasArg(options::OPT_verify_pch)) return llvm::make_unique(std::move(Input), types::TY_Nothing); + return llvm::make_unique(std::move(Input), + types::TY_LLVM_BC); + } + case phases::Backend: { if (IsUsingLTO(Args)) { types::ID Output = Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC; - return llvm::make_unique(std::move(Input), Output); + return llvm::make_unique(std::move(Input), Output); } if (Args.hasArg(options::OPT_emit_llvm)) { types::ID Output = Args.hasArg(options::OPT_S) ? types::TY_LLVM_IR : types::TY_LLVM_BC; - return llvm::make_unique(std::move(Input), Output); + return llvm::make_unique(std::move(Input), Output); } - return llvm::make_unique(std::move(Input), + return llvm::make_unique(std::move(Input), types::TY_PP_Asm); } case phases::Assemble: @@ -1486,7 +1495,7 @@ static const Tool *SelectToolForJob(Compilation &C, const ToolChain *TC, // See if we should look for a compiler with an integrated assembler. We match // bottom up, so what we are actually looking for is an assembler job with a - // compiler input. + // compiler or backend input. if (TC->useIntegratedAs() && !C.getArgs().hasArg(options::OPT_save_temps) && @@ -1494,12 +1503,14 @@ static const Tool *SelectToolForJob(Compilation &C, const ToolChain *TC, !C.getArgs().hasArg(options::OPT__SLASH_FA) && !C.getArgs().hasArg(options::OPT__SLASH_Fa) && isa(JA) && - Inputs->size() == 1 && isa(*Inputs->begin())) { + Inputs->size() == 1 && (isa(*Inputs->begin()) || + isa(*Inputs->begin()))) { const Tool *Compiler = TC->SelectTool(cast(**Inputs->begin())); if (!Compiler) return nullptr; if (Compiler->hasIntegratedAssembler()) { + JA = cast(*Inputs->begin()); Inputs = &(*Inputs)[0]->getInputs(); ToolForJob = Compiler; } @@ -1509,6 +1520,12 @@ static const Tool *SelectToolForJob(Compilation &C, const ToolChain *TC, if (!ToolForJob) ToolForJob = TC->SelectTool(*JA); + // Unless OPT_save_temps is enabled, combine the compile and backend jobs. + if (isa(JA) && + Inputs->size() == 1 && isa(*Inputs->begin()) && + !C.getArgs().hasArg(options::OPT_save_temps)) + Inputs = &(*Inputs)[0]->getInputs(); + // See if we should use an integrated preprocessor. We do so when we have // exactly one input, since this is the only use case we care about // (irrelevant since we don't support combine yet). @@ -1751,6 +1768,12 @@ const char *Driver::GetNamedOutputPath(Compilation &C, Suffixed += "-"; Suffixed.append(BoundArch); } + // When using both -save-temps and -emit-llvm, use a ".tmp.bc" suffix for + // the unoptimized bitcode so that it does not get overwritten by the ".bc" + // optimized bitcode output. + if (!AtTopLevel && C.getArgs().hasArg(options::OPT_emit_llvm) && + JA.getType() == types::TY_LLVM_BC) + Suffixed += ".tmp"; Suffixed += '.'; Suffixed += Suffix; NamedOutput = C.getArgs().MakeArgString(Suffixed.c_str()); @@ -2083,7 +2106,7 @@ bool Driver::ShouldUseClangCompiler(const JobAction &JA) const { // Otherwise make sure this is an action clang understands. if (!isa(JA) && !isa(JA) && - !isa(JA)) + !isa(JA) && !isa(JA)) return false; return true; diff --git a/lib/Driver/Phases.cpp b/lib/Driver/Phases.cpp index 155e53b64f..7ae270857f 100644 --- a/lib/Driver/Phases.cpp +++ b/lib/Driver/Phases.cpp @@ -18,6 +18,7 @@ const char *phases::getPhaseName(ID Id) { case Preprocess: return "preprocessor"; case Precompile: return "precompiler"; case Compile: return "compiler"; + case Backend: return "backend"; case Assemble: return "assembler"; case Link: return "linker"; } diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp index 6734ce7d70..2bcfecf6bd 100644 --- a/lib/Driver/ToolChain.cpp +++ b/lib/Driver/ToolChain.cpp @@ -129,6 +129,7 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const { case Action::AnalyzeJobClass: case Action::MigrateJobClass: case Action::VerifyPCHJobClass: + case Action::BackendJobClass: return getClang(); } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 77e4e125e6..1903f3212f 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2002,7 +2002,7 @@ static bool ShouldDisableDwarfDirectory(const ArgList &Args, /// \brief Check whether the given input tree contains any compilation actions. static bool ContainsCompileAction(const Action *A) { - if (isa(A)) + if (isa(A) || isa(A)) return true; for (const auto &Act : *A) @@ -2528,7 +2528,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } else if (isa(JA)) { CmdArgs.push_back("-verify-pch"); } else { - assert(isa(JA) && "Invalid action for clang tool."); + assert((isa(JA) || isa(JA)) && + "Invalid action for clang tool."); if (JA.getType() == types::TY_Nothing) { CmdArgs.push_back("-fsyntax-only"); @@ -4405,18 +4406,27 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option // parser. Args.AddAllArgValues(CmdArgs, options::OPT_Xclang); + bool OptDisabled = false; for (arg_iterator it = Args.filtered_begin(options::OPT_mllvm), ie = Args.filtered_end(); it != ie; ++it) { (*it)->claim(); // We translate this by hand to the -cc1 argument, since nightly test uses // it and developers have been trained to spell it with -mllvm. - if (StringRef((*it)->getValue(0)) == "-disable-llvm-optzns") + if (StringRef((*it)->getValue(0)) == "-disable-llvm-optzns") { CmdArgs.push_back("-disable-llvm-optzns"); - else + OptDisabled = true; + } else (*it)->render(Args, CmdArgs); } + // With -save-temps, we want to save the unoptimized bitcode output from the + // CompileJobAction, so disable optimizations if they are not already + // disabled. + if (Args.hasArg(options::OPT_save_temps) && !OptDisabled && + isa(JA)) + CmdArgs.push_back("-disable-llvm-optzns"); + if (Output.getType() == types::TY_Dependencies) { // Handled with other dependency code. } else if (Output.isFilename()) { @@ -4462,7 +4472,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // can propagate it to the backend. bool SplitDwarf = Args.hasArg(options::OPT_gsplit_dwarf) && getToolChain().getTriple().isOSLinux() && - (isa(JA) || isa(JA)); + (isa(JA) || isa(JA) || + isa(JA)); const char *SplitDwarfOut; if (SplitDwarf) { CmdArgs.push_back("-split-dwarf-file"); @@ -4486,7 +4497,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Handle the debug info splitting at object creation time if we're // creating an object. // TODO: Currently only works on linux with newer objcopy. - if (SplitDwarf && !isa(JA)) + if (SplitDwarf && !isa(JA) && !isa(JA)) SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output, SplitDwarfOut); if (Arg *A = Args.getLastArg(options::OPT_pg)) diff --git a/lib/Driver/Types.cpp b/lib/Driver/Types.cpp index 4a22dcff46..6ee764c64e 100644 --- a/lib/Driver/Types.cpp +++ b/lib/Driver/Types.cpp @@ -203,6 +203,7 @@ void types::getCompilationPhases(ID Id, llvm::SmallVectorImpl &P) { } else { if (!onlyAssembleType(Id)) { P.push_back(phases::Compile); + P.push_back(phases::Backend); } P.push_back(phases::Assemble); } diff --git a/test/Driver/ast.c b/test/Driver/ast.c index 83dfcc37a9..c1d7b1a6d7 100644 --- a/test/Driver/ast.c +++ b/test/Driver/ast.c @@ -16,9 +16,10 @@ // COMPILE-AST-PHASES: 0: input, // COMPILE-AST-PHASES: , ast -// COMPILE-AST-PHASES: 1: compiler, {0}, assembler -// COMPILE-AST-PHASES: 2: assembler, {1}, object -// COMPILE-AST-PHASES-NOT: 3: +// COMPILE-AST-PHASES: 1: compiler, {0}, ir +// COMPILE-AST-PHASES: 2: backend, {1}, assembler +// COMPILE-AST-PHASES: 3: assembler, {2}, object +// COMPILE-AST-PHASES-NOT: 4: // COMPILE-AST-PHASES: END // FIXME: There is a problem with compiling AST's in that the input language is diff --git a/test/Driver/darwin-dsymutil.c b/test/Driver/darwin-dsymutil.c index 59084a2c85..0e2c490710 100644 --- a/test/Driver/darwin-dsymutil.c +++ b/test/Driver/darwin-dsymutil.c @@ -6,13 +6,14 @@ // // CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-dsymutil.c", c // CHECK-MULTIARCH-ACTIONS: 1: preprocessor, {0}, cpp-output -// CHECK-MULTIARCH-ACTIONS: 2: compiler, {1}, assembler -// CHECK-MULTIARCH-ACTIONS: 3: assembler, {2}, object -// CHECK-MULTIARCH-ACTIONS: 4: linker, {3}, image -// CHECK-MULTIARCH-ACTIONS: 5: bind-arch, "i386", {4}, image -// CHECK-MULTIARCH-ACTIONS: 6: bind-arch, "x86_64", {4}, image -// CHECK-MULTIARCH-ACTIONS: 7: lipo, {5, 6}, image -// CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM +// CHECK-MULTIARCH-ACTIONS: 2: compiler, {1}, ir +// CHECK-MULTIARCH-ACTIONS: 3: backend, {2}, assembler +// CHECK-MULTIARCH-ACTIONS: 4: assembler, {3}, object +// CHECK-MULTIARCH-ACTIONS: 5: linker, {4}, image +// CHECK-MULTIARCH-ACTIONS: 6: bind-arch, "i386", {5}, image +// CHECK-MULTIARCH-ACTIONS: 7: bind-arch, "x86_64", {5}, image +// CHECK-MULTIARCH-ACTIONS: 8: lipo, {6, 7}, image +// CHECK-MULTIARCH-ACTIONS: 9: dsymutil, {8}, dSYM // // RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \ // RUN: -arch i386 -arch x86_64 %s -g 2> %t diff --git a/test/Driver/darwin-verify-debug.c b/test/Driver/darwin-verify-debug.c index 50a6cf31b8..ebbf89a4d6 100644 --- a/test/Driver/darwin-verify-debug.c +++ b/test/Driver/darwin-verify-debug.c @@ -5,8 +5,8 @@ // RUN: FileCheck -check-prefix=CHECK-MULTIARCH-ACTIONS < %t %s // // CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-verify-debug.c", c -// CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM -// CHECK-MULTIARCH-ACTIONS: 9: verify-debug-info, {8}, none +// CHECK-MULTIARCH-ACTIONS: 9: dsymutil, {8}, dSYM +// CHECK-MULTIARCH-ACTIONS: 10: verify-debug-info, {9}, none // // RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \ // RUN: --verify-debug-info -arch i386 -arch x86_64 %s -g 2> %t diff --git a/test/Driver/lto.c b/test/Driver/lto.c index 91524bf78b..ec6b3f1162 100644 --- a/test/Driver/lto.c +++ b/test/Driver/lto.c @@ -1,18 +1,21 @@ // -flto causes a switch to llvm-bc object files. // RUN: %clang -ccc-print-phases -c %s -flto 2> %t.log -// RUN: grep '2: compiler, {1}, lto-bc' %t.log +// RUN: grep '2: compiler, {1}, ir' %t.log +// RUN: grep '3: backend, {2}, lto-bc' %t.log // RUN: %clang -ccc-print-phases %s -flto 2> %t.log // RUN: grep '0: input, ".*lto.c", c' %t.log // RUN: grep '1: preprocessor, {0}, cpp-output' %t.log -// RUN: grep '2: compiler, {1}, lto-bc' %t.log -// RUN: grep '3: linker, {2}, image' %t.log +// RUN: grep '2: compiler, {1}, ir' %t.log +// RUN: grep '3: backend, {2}, lto-bc' %t.log +// RUN: grep '4: linker, {3}, image' %t.log // llvm-bc and llvm-ll outputs need to match regular suffixes // (unfortunately). // RUN: %clang %s -flto -save-temps -### 2> %t.log // RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log -// RUN: grep '"-o" ".*lto\.o" .*".*lto\.i"' %t.log +// RUN: grep '"-o" ".*lto\.bc" .*".*lto\.i"' %t.log +// RUN: grep '"-o" ".*lto\.o" .*".*lto\.bc"' %t.log // RUN: grep '".*a.out" .*".*lto\.o"' %t.log // RUN: %clang %s -flto -S -### 2> %t.log diff --git a/test/Driver/phases.c b/test/Driver/phases.c index 4c480d59c1..0283800825 100644 --- a/test/Driver/phases.c +++ b/test/Driver/phases.c @@ -2,47 +2,53 @@ // RUN: %clang -target i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2>&1 | FileCheck -check-prefix=BASIC %s // BASIC: 0: input, "{{.*}}phases.c", c // BASIC: 1: preprocessor, {0}, cpp-output -// BASIC: 2: compiler, {1}, assembler -// BASIC: 3: assembler, {2}, object -// BASIC: 4: input, "{{.*}}phases.c", objective-c -// BASIC: 5: preprocessor, {4}, objective-c-cpp-output -// BASIC: 6: compiler, {5}, assembler -// BASIC: 7: assembler, {6}, object -// BASIC: 8: input, "{{.*}}phases.c", c++ -// BASIC: 9: preprocessor, {8}, c++-cpp-output -// BASIC: 10: compiler, {9}, assembler -// BASIC: 11: assembler, {10}, object -// BASIC: 12: input, "{{.*}}phases.c", assembler -// BASIC: 13: assembler, {12}, object -// BASIC: 14: input, "{{.*}}phases.c", assembler-with-cpp -// BASIC: 15: preprocessor, {14}, assembler +// BASIC: 2: compiler, {1}, ir +// BASIC: 3: backend, {2}, assembler +// BASIC: 4: assembler, {3}, object +// BASIC: 5: input, "{{.*}}phases.c", objective-c +// BASIC: 6: preprocessor, {5}, objective-c-cpp-output +// BASIC: 7: compiler, {6}, ir +// BASIC: 8: backend, {7}, assembler +// BASIC: 9: assembler, {8}, object +// BASIC: 10: input, "{{.*}}phases.c", c++ +// BASIC: 11: preprocessor, {10}, c++-cpp-output +// BASIC: 12: compiler, {11}, ir +// BASIC: 13: backend, {12}, assembler +// BASIC: 14: assembler, {13}, object +// BASIC: 15: input, "{{.*}}phases.c", assembler // BASIC: 16: assembler, {15}, object -// BASIC: 17: input, "{{.*}}phases.c", c -// BASIC: 18: preprocessor, {17}, cpp-output -// BASIC: 19: compiler, {18}, assembler -// BASIC: 20: assembler, {19}, object -// BASIC: 21: linker, {3, 7, 11, 13, 16, 20}, image +// BASIC: 17: input, "{{.*}}phases.c", assembler-with-cpp +// BASIC: 18: preprocessor, {17}, assembler +// BASIC: 19: assembler, {18}, object +// BASIC: 20: input, "{{.*}}phases.c", c +// BASIC: 21: preprocessor, {20}, cpp-output +// BASIC: 22: compiler, {21}, ir +// BASIC: 23: backend, {22}, assembler +// BASIC: 24: assembler, {23}, object +// BASIC: 25: linker, {4, 9, 14, 16, 19, 24}, image // Universal linked image. // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s // ULI: 0: input, "{{.*}}phases.c", c // ULI: 1: preprocessor, {0}, cpp-output -// ULI: 2: compiler, {1}, assembler -// ULI: 3: assembler, {2}, object -// ULI: 4: linker, {3}, image -// ULI: 5: bind-arch, "ppc", {4}, image -// ULI: 6: bind-arch, "i386", {4}, image -// ULI: 7: lipo, {5, 6}, image +// ULI: 2: compiler, {1}, ir +// ULI: 3: backend, {2}, assembler +// ULI: 4: assembler, {3}, object +// ULI: 5: linker, {4}, image +// ULI: 6: bind-arch, "ppc", {5}, image +// ULI: 7: bind-arch, "i386", {5}, image +// ULI: 8: lipo, {6, 7}, image // Universal object file. // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s // UOF: 0: input, "{{.*}}phases.c", c // UOF: 1: preprocessor, {0}, cpp-output -// UOF: 2: compiler, {1}, assembler -// UOF: 3: assembler, {2}, object -// UOF: 4: bind-arch, "ppc", {3}, object -// UOF: 5: bind-arch, "i386", {3}, object -// UOF: 6: lipo, {4, 5}, object +// UOF: 2: compiler, {1}, ir +// UOF: 3: backend, {2}, assembler +// UOF: 4: assembler, {3}, object +// UOF: 5: bind-arch, "ppc", {4}, object +// UOF: 6: bind-arch, "i386", {4}, object +// UOF: 7: lipo, {5, 6}, object // Arch defaulting // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s diff --git a/test/Driver/save-temps.c b/test/Driver/save-temps.c index a4ca3b2664..a157aeaaff 100644 --- a/test/Driver/save-temps.c +++ b/test/Driver/save-temps.c @@ -1,17 +1,28 @@ // RUN: %clang -target x86_64-apple-darwin -save-temps -arch x86_64 %s -### 2>&1 \ // RUN: | FileCheck %s // CHECK: "-o" "save-temps.i" +// CHECK: "-disable-llvm-optzns" +// CHECK: "-o" "save-temps.bc" // CHECK: "-o" "save-temps.s" // CHECK: "-o" "save-temps.o" // CHECK: "-o" "a.out" +// Check for a single clang cc1 invocation when NOT using -save-temps. +// RUN: %clang -target x86_64-apple-darwin -arch x86_64 -S %s -### 2>&1 \ +// RUN: | FileCheck %s -check-prefix=NO-TEMPS +// NO-TEMPS: "-cc1" +// NO-TEMPS: "-S" +// NO-TEMPS: "-x" "c" + // RUN: %clang -target x86_64-apple-darwin -save-temps -arch i386 -arch x86_64 %s -### 2>&1 \ // RUN: | FileCheck %s -check-prefix=MULT-ARCH // MULT-ARCH: "-o" "save-temps-i386.i" +// MULT-ARCH: "-o" "save-temps-i386.bc" // MULT-ARCH: "-o" "save-temps-i386.s" // MULT-ARCH: "-o" "save-temps-i386.o" // MULT-ARCH: "-o" "a.out-i386" // MULT-ARCH: "-o" "save-temps-x86_64.i" +// MULT-ARCH: "-o" "save-temps-x86_64.bc" // MULT-ARCH: "-o" "save-temps-x86_64.s" // MULT-ARCH: "-o" "save-temps-x86_64.o" // MULT-ARCH: "-o" "a.out-x86_64"