Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -2927,10 +2927,11 @@ Opts.FPMath = Args.getLastArgValue(OPT_mfpmath); Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature); Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version); - Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple)); + Opts.Triple = Args.getLastArgValue(OPT_triple); // Use the default target triple if unspecified. if (Opts.Triple.empty()) Opts.Triple = llvm::sys::getDefaultTargetTriple(); + Opts.Triple = llvm::Triple::normalize(Opts.Triple); Opts.OpenCLExtensionsAsWritten = Args.getAllArgValues(OPT_cl_ext_EQ); Opts.ForceEnableInt128 = Args.hasArg(OPT_fforce_enable_int128); Opts.NVPTXUseShortPointers = Args.hasFlag( Index: llvm/cmake/modules/GetHostTriple.cmake =================================================================== --- llvm/cmake/modules/GetHostTriple.cmake +++ llvm/cmake/modules/GetHostTriple.cmake @@ -4,15 +4,15 @@ function( get_host_triple var ) if( MSVC ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( value "x86_64-pc-win32" ) + set( value "x86_64-pc-windows-msvc" ) else() - set( value "i686-pc-win32" ) + set( value "i686-pc-windows-msvc" ) endif() elseif( MINGW AND NOT MSYS ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( value "x86_64-w64-mingw32" ) + set( value "x86_64-w64-windows-gnu" ) else() - set( value "i686-pc-mingw32" ) + set( value "i686-pc-windows-gnu" ) endif() else( MSVC ) set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess) Index: llvm/lib/Support/Unix/Host.inc =================================================================== --- llvm/lib/Support/Unix/Host.inc +++ llvm/lib/Support/Unix/Host.inc @@ -64,5 +64,5 @@ TargetTripleString = EnvTriple; #endif - return Triple::normalize(TargetTripleString); + return TargetTripleString; } Index: llvm/lib/Support/Windows/Host.inc =================================================================== --- llvm/lib/Support/Windows/Host.inc +++ llvm/lib/Support/Windows/Host.inc @@ -30,5 +30,5 @@ Triple = EnvTriple; #endif - return Triple::normalize(Triple); + return Triple; } Index: llvm/utils/lit/lit/llvm/config.py =================================================================== --- llvm/utils/lit/lit/llvm/config.py +++ llvm/utils/lit/lit/llvm/config.py @@ -232,31 +232,31 @@ return False def make_itanium_abi_triple(self, triple): - m = re.match(r'(\w+)-(\w+)-(\w+)', triple) + m = re.match(r'(\w+)-(\w+)-(\w+)(?:-(\w+))?', triple) if not m: self.lit_config.fatal( "Could not turn '%s' into Itanium ABI triple" % triple) - if m.group(3).lower() != 'win32': + if m.group(3).lower() != 'windows': # All non-win32 triples use the Itanium ABI. return triple - return m.group(1) + '-' + m.group(2) + '-mingw32' + return m.group(1) + '-' + m.group(2) + '-' + m.group(3) + '-gnu' def make_msabi_triple(self, triple): - m = re.match(r'(\w+)-(\w+)-(\w+)', triple) + m = re.match(r'(\w+)-(\w+)-(\w+)(?:-(\w+))?', triple) if not m: self.lit_config.fatal( "Could not turn '%s' into MS ABI triple" % triple) isa = m.group(1).lower() vendor = m.group(2).lower() os = m.group(3).lower() - if os == 'win32': + if os == 'windows': # If the OS is win32, we're done. return triple if isa.startswith('x86') or isa == 'amd64' or re.match(r'i\d86', isa): # For x86 ISAs, adjust the OS. - return isa + '-' + vendor + '-win32' - # -win32 is not supported for non-x86 targets; use a default. - return 'i686-pc-win32' + return isa + '-' + vendor + 'windows-msvc' + # -msvc is not supported for non-x86 targets; use a default. + return 'i686-pc-windows-msvc' def add_tool_substitutions(self, tools, search_dirs=None): if not search_dirs: