Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1949,7 +1949,7 @@ def fapple_link_rtlib : Flag<["-"], "fapple-link-rtlib">, Group, HelpText<"Force linking the clang builtins runtime library">; def flto_EQ : Joined<["-"], "flto=">, Flags<[CoreOption, CC1Option]>, Group, - HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full">; + HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full,auto,jobserver">; def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option]>, Group, HelpText<"Enable LTO in 'full' mode">; def fno_lto : Flag<["-"], "fno-lto">, Flags<[CoreOption, CC1Option]>, Group, @@ -4244,8 +4244,6 @@ defm branch_count_reg : BooleanFFlag<"branch-count-reg">, Group; defm default_inline : BooleanFFlag<"default-inline">, Group; defm fat_lto_objects : BooleanFFlag<"fat-lto-objects">, Group; -def : Flag<["-"], "flto=auto">, Group; -def : Flag<["-"], "flto=jobserver">, Group; defm float_store : BooleanFFlag<"float-store">, Group; defm friend_injection : BooleanFFlag<"friend-injection">, Group; defm function_attribute_list : BooleanFFlag<"function-attribute-list">, Group; Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -609,6 +609,8 @@ LTOMode = llvm::StringSwitch(LTOName) .Case("full", LTOK_Full) + .Case("auto", LTOK_Full) // GCC compatibility + .Case("jobserver", LTOK_Full) // GCC compatibility .Case("thin", LTOK_Thin) .Default(LTOK_Unknown); Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -1707,8 +1707,7 @@ StringRef S = A->getValue(); if (S == "thin") Opts.PrepareForThinLTO = true; - else if (S != "full") - Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << S; + // -flto=full and invalid values are handled elsewhere. } if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) { if (IK.getLanguage() != Language::LLVM_IR) Index: clang/test/CodeGen/thinlto-backend-option.ll =================================================================== --- clang/test/CodeGen/thinlto-backend-option.ll +++ clang/test/CodeGen/thinlto-backend-option.ll @@ -12,6 +12,3 @@ ; RUN: llvm-lto -thinlto -o %t %t.o ; RUN: not %clang_cc1 -x ir %t.o -fthinlto-index=%t.thinlto.bc -mllvm -nonexistent -emit-obj -o /dev/null 2>&1 | FileCheck %s -check-prefix=UNKNOWN ; UNKNOWN: clang (LLVM option parsing): Unknown command line argument '-nonexistent' - -; RUN: not %clang_cc1 -flto=thinfoo 2>&1 | FileCheck %s -check-prefix=INVALID -; INVALID: error: invalid value 'thinfoo' in '-flto=thinfoo' Index: clang/test/Driver/autocomplete.c =================================================================== --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -72,7 +72,9 @@ // FFPALL-NEXT: off // FFPALL-NEXT: on // RUN: %clang --autocomplete=-flto= | FileCheck %s -check-prefix=FLTOALL -// FLTOALL: full +// FLTOALL: auto +// FLTOALL-NEXT: full +// FLTOALL-NEXT: jobserver // FLTOALL-NEXT: thin // RUN: %clang --autocomplete=-fveclib= | FileCheck %s -check-prefix=FVECLIBALL // FVECLIBALL: Accelerate