diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -424,14 +424,17 @@ case '3': OLvl = CodeGenOpt::Aggressive; break; } - TargetOptions Options = codegen::InitTargetOptionsFromCodeGenFlags(); - Options.DisableIntegratedAS = NoIntegratedAssembler; - Options.MCOptions.ShowMCEncoding = ShowMCEncoding; - Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory; - Options.MCOptions.AsmVerbose = AsmVerbose; - Options.MCOptions.PreserveAsmComments = PreserveComments; - Options.MCOptions.IASSearchPaths = IncludeDirs; - Options.MCOptions.SplitDwarfFile = SplitDwarfFile; + TargetOptions Options; + auto InitializeOptions = [&](Triple &TheTriple) { + Options = codegen::InitTargetOptionsFromCodeGenFlags(); + Options.DisableIntegratedAS = NoIntegratedAssembler; + Options.MCOptions.ShowMCEncoding = ShowMCEncoding; + Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory; + Options.MCOptions.AsmVerbose = AsmVerbose; + Options.MCOptions.PreserveAsmComments = PreserveComments; + Options.MCOptions.IASSearchPaths = IncludeDirs; + Options.MCOptions.SplitDwarfFile = SplitDwarfFile; + }; Optional RM = codegen::getExplicitRelocModel(); @@ -466,6 +469,7 @@ exit(1); } + InitializeOptions(TheTriple); Target = std::unique_ptr(TheTarget->createTargetMachine( TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM, codegen::getExplicitCodeModel(), OLvl)); @@ -510,6 +514,7 @@ return 1; } + InitializeOptions(TheTriple); Target = std::unique_ptr(TheTarget->createTargetMachine( TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM, codegen::getExplicitCodeModel(), OLvl));