-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[TargetRegistry] Accept Triple in createTargetMachine() (NFC) #130940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This avoids doing a Triple -> std::string -> Triple round trip in lots of places, now that the Module stores a Triple.
@llvm/pr-subscribers-offload @llvm/pr-subscribers-backend-amdgpu Author: Nikita Popov (nikic) ChangesThis avoids doing a Triple -> std::string -> Triple round trip in lots of places, now that the Module stores a Triple. Patch is 51.13 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/130940.diff 62 Files Affected:
diff --git a/bolt/lib/Passes/AsmDump.cpp b/bolt/lib/Passes/AsmDump.cpp
index 97f985d56ce64..08191669e72f3 100644
--- a/bolt/lib/Passes/AsmDump.cpp
+++ b/bolt/lib/Passes/AsmDump.cpp
@@ -143,7 +143,7 @@ void dumpFunction(const BinaryFunction &BF) {
std::move(MCEInstance.MCE), std::move(MAB)));
AsmStreamer->initSections(true, *BC.STI);
std::unique_ptr<TargetMachine> TM(BC.TheTarget->createTargetMachine(
- BC.TripleName, "", "", TargetOptions(), std::nullopt));
+ *BC.TheTriple, "", "", TargetOptions(), std::nullopt));
std::unique_ptr<AsmPrinter> MAP(
BC.TheTarget->createAsmPrinter(*TM, std::move(AsmStreamer)));
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 62a0e3c69bad1..7557cb8408921 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -595,7 +595,7 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) {
void EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
// Create the TargetMachine for generating code.
std::string Error;
- std::string Triple = TheModule->getTargetTriple().str();
+ const llvm::Triple &Triple = TheModule->getTargetTriple();
const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error);
if (!TheTarget) {
if (MustCreateTM)
diff --git a/clang/lib/Interpreter/DeviceOffload.cpp b/clang/lib/Interpreter/DeviceOffload.cpp
index 5e35fa035b2b8..1999d63d1aa04 100644
--- a/clang/lib/Interpreter/DeviceOffload.cpp
+++ b/clang/lib/Interpreter/DeviceOffload.cpp
@@ -83,7 +83,7 @@ llvm::Expected<llvm::StringRef> IncrementalCUDADeviceParser::GeneratePTX() {
std::error_code());
llvm::TargetOptions TO = llvm::TargetOptions();
llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
- PTU.TheModule->getTargetTriple().str(), TargetOpts.CPU, "", TO,
+ PTU.TheModule->getTargetTriple(), TargetOpts.CPU, "", TO,
llvm::Reloc::Model::PIC_);
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index 6f584fab52ba9..f7cb7598c77f8 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -73,9 +73,8 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
}
llvm::TargetOptions TO = llvm::TargetOptions();
- llvm::TargetMachine *TargetMachine =
- Target->createTargetMachine(PTU.TheModule->getTargetTriple().str(), "",
- "", TO, llvm::Reloc::Model::PIC_);
+ llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
+ PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";
std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";
diff --git a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
index 4618c0bcc6be8..798b34b3ef0af 100644
--- a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -127,8 +127,8 @@ static std::string OptLLVM(const std::string &IR, CodeGenOptLevel OLvl) {
ErrorAndExit(E);
std::unique_ptr<TargetMachine> TM(TheTarget->createTargetMachine(
- M->getTargetTriple().str(), codegen::getCPUStr(),
- codegen::getFeaturesStr(), Options, codegen::getExplicitRelocModel(),
+ M->getTargetTriple(), codegen::getCPUStr(), codegen::getFeaturesStr(),
+ Options, codegen::getExplicitRelocModel(),
codegen::getExplicitCodeModel(), OLvl));
if (!TM)
ErrorAndExit("Could not create target machine");
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index dcfed14746200..8d63d2c414cef 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -637,7 +637,7 @@ Expected<StringRef> compileModule(Module &M, OffloadKind Kind) {
StringRef CPU = "";
StringRef Features = "";
std::unique_ptr<TargetMachine> TM(
- T->createTargetMachine(M.getTargetTriple().str(), CPU, Features, Options,
+ T->createTargetMachine(M.getTargetTriple(), CPU, Features, Options,
Reloc::PIC_, M.getCodeModel()));
if (M.getDataLayout().isDefault())
diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp
index 26b5e78cfb4b5..341520c6a6f73 100644
--- a/clang/tools/driver/cc1_main.cpp
+++ b/clang/tools/driver/cc1_main.cpp
@@ -111,9 +111,10 @@ static void ensureSufficientStack() {}
/// Print supported cpus of the given target.
static int PrintSupportedCPUs(std::string TargetStr) {
+ llvm::Triple Triple(TargetStr);
std::string Error;
const llvm::Target *TheTarget =
- llvm::TargetRegistry::lookupTarget(TargetStr, Error);
+ llvm::TargetRegistry::lookupTarget(Triple, Error);
if (!TheTarget) {
llvm::errs() << Error;
return 1;
@@ -122,15 +123,16 @@ static int PrintSupportedCPUs(std::string TargetStr) {
// the target machine will handle the mcpu printing
llvm::TargetOptions Options;
std::unique_ptr<llvm::TargetMachine> TheTargetMachine(
- TheTarget->createTargetMachine(TargetStr, "", "+cpuhelp", Options,
+ TheTarget->createTargetMachine(Triple, "", "+cpuhelp", Options,
std::nullopt));
return 0;
}
static int PrintSupportedExtensions(std::string TargetStr) {
+ llvm::Triple Triple(TargetStr);
std::string Error;
const llvm::Target *TheTarget =
- llvm::TargetRegistry::lookupTarget(TargetStr, Error);
+ llvm::TargetRegistry::lookupTarget(Triple, Error);
if (!TheTarget) {
llvm::errs() << Error;
return 1;
@@ -138,7 +140,7 @@ static int PrintSupportedExtensions(std::string TargetStr) {
llvm::TargetOptions Options;
std::unique_ptr<llvm::TargetMachine> TheTargetMachine(
- TheTarget->createTargetMachine(TargetStr, "", "", Options, std::nullopt));
+ TheTarget->createTargetMachine(Triple, "", "", Options, std::nullopt));
const llvm::Triple &MachineTriple = TheTargetMachine->getTargetTriple();
const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo();
const llvm::ArrayRef<llvm::SubtargetFeatureKV> Features =
@@ -165,9 +167,10 @@ static int PrintSupportedExtensions(std::string TargetStr) {
}
static int PrintEnabledExtensions(const TargetOptions& TargetOpts) {
+ llvm::Triple Triple(TargetOpts.Triple);
std::string Error;
const llvm::Target *TheTarget =
- llvm::TargetRegistry::lookupTarget(TargetOpts.Triple, Error);
+ llvm::TargetRegistry::lookupTarget(Triple, Error);
if (!TheTarget) {
llvm::errs() << Error;
return 1;
@@ -179,7 +182,8 @@ static int PrintEnabledExtensions(const TargetOptions& TargetOpts) {
llvm::TargetOptions BackendOptions;
std::string FeaturesStr = llvm::join(TargetOpts.FeaturesAsWritten, ",");
std::unique_ptr<llvm::TargetMachine> TheTargetMachine(
- TheTarget->createTargetMachine(TargetOpts.Triple, TargetOpts.CPU, FeaturesStr, BackendOptions, std::nullopt));
+ TheTarget->createTargetMachine(Triple, TargetOpts.CPU, FeaturesStr,
+ BackendOptions, std::nullopt));
const llvm::Triple &MachineTriple = TheTargetMachine->getTargetTriple();
const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo();
diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp
index 3b19a1c2a78d9..efaeb0c0a3891 100644
--- a/flang/tools/bbc/bbc.cpp
+++ b/flang/tools/bbc/bbc.cpp
@@ -280,7 +280,7 @@ createTargetMachine(llvm::StringRef targetTriple, std::string &error) {
if (!theTarget)
return nullptr;
return std::unique_ptr<llvm::TargetMachine>{
- theTarget->createTargetMachine(triple, /*CPU=*/"",
+ theTarget->createTargetMachine(llvm::Triple(triple), /*CPU=*/"",
/*Features=*/"", llvm::TargetOptions(),
/*Reloc::Model=*/std::nullopt)};
}
diff --git a/flang/tools/flang-driver/fc1_main.cpp b/flang/tools/flang-driver/fc1_main.cpp
index 561a0dd5524e3..49535275d084d 100644
--- a/flang/tools/flang-driver/fc1_main.cpp
+++ b/flang/tools/flang-driver/fc1_main.cpp
@@ -45,8 +45,8 @@ static int printSupportedCPUs(llvm::StringRef triple) {
// the target machine will handle the mcpu printing
llvm::TargetOptions targetOpts;
std::unique_ptr<llvm::TargetMachine> targetMachine(
- target->createTargetMachine(triple, "", "+cpuhelp", targetOpts,
- std::nullopt));
+ target->createTargetMachine(llvm::Triple(triple), "", "+cpuhelp",
+ targetOpts, std::nullopt));
return 0;
}
diff --git a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
index e2e54306dd2fd..739b8954aa8b2 100644
--- a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -1243,7 +1243,7 @@ int main() {
TargetOptions opt;
auto TheTargetMachine = Target->createTargetMachine(
- TargetTriple, CPU, Features, opt, Reloc::PIC_);
+ Triple(TargetTriple), CPU, Features, opt, Reloc::PIC_);
TheModule->setDataLayout(TheTargetMachine->createDataLayout());
diff --git a/llvm/include/llvm/MC/TargetRegistry.h b/llvm/include/llvm/MC/TargetRegistry.h
index 363fa03f27a70..0e9fab7c27a8f 100644
--- a/llvm/include/llvm/MC/TargetRegistry.h
+++ b/llvm/include/llvm/MC/TargetRegistry.h
@@ -453,14 +453,14 @@ class Target {
/// either the target triple from the module, or the target triple of the
/// host if that does not exist.
TargetMachine *createTargetMachine(
- StringRef TT, StringRef CPU, StringRef Features,
+ const Triple &TT, StringRef CPU, StringRef Features,
const TargetOptions &Options, std::optional<Reloc::Model> RM,
std::optional<CodeModel::Model> CM = std::nullopt,
CodeGenOptLevel OL = CodeGenOptLevel::Default, bool JIT = false) const {
if (!TargetMachineCtorFn)
return nullptr;
- return TargetMachineCtorFn(*this, Triple(TT), CPU, Features, Options, RM,
- CM, OL, JIT);
+ return TargetMachineCtorFn(*this, TT, CPU, Features, Options, RM, CM, OL,
+ JIT);
}
/// createMCAsmBackend - Create a target specific assembly parser.
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index 023656cde0089..9512f7993bd93 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -764,7 +764,7 @@ codegen::createTargetMachineForTriple(StringRef TargetTriple,
if (!TheTarget)
return createStringError(inconvertibleErrorCode(), Error);
auto *Target = TheTarget->createTargetMachine(
- TheTriple.getTriple(), codegen::getCPUStr(), codegen::getFeaturesStr(),
+ TheTriple, codegen::getCPUStr(), codegen::getFeaturesStr(),
codegen::InitTargetOptionsFromCodeGenFlags(TheTriple),
codegen::getExplicitRelocModel(), codegen::getExplicitCodeModel(),
OptLevel);
diff --git a/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
index 947db9cbcd92d..55e40cd779cbf 100644
--- a/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp
@@ -123,7 +123,7 @@ Error DwarfStreamer::init(Triple TheTriple,
TripleName.c_str());
// Finally create the AsmPrinter we'll use to emit the DIEs.
- TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
+ TM.reset(TheTarget->createTargetMachine(TheTriple, "", "", TargetOptions(),
std::nullopt));
if (!TM)
return createStringError(std::errc::invalid_argument,
diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
index fbab6b25ca0f1..4cd1875b37f5b 100644
--- a/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
+++ b/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp
@@ -102,7 +102,7 @@ Error DwarfEmitterImpl::init(Triple TheTriple,
TripleName.c_str());
// Finally create the AsmPrinter we'll use to emit the DIEs.
- TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
+ TM.reset(TheTarget->createTargetMachine(TheTriple, "", "", TargetOptions(),
std::nullopt));
if (!TM)
return createStringError(std::errc::invalid_argument,
diff --git a/llvm/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp b/llvm/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
index 5ae1ac6e4250d..dfd443c80283f 100644
--- a/llvm/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
@@ -47,9 +47,8 @@ JITTargetMachineBuilder::createTargetMachine() {
return make_error<StringError>("Target has no JIT support",
inconvertibleErrorCode());
- auto *TM =
- TheTarget->createTargetMachine(TT.getTriple(), CPU, Features.getString(),
- Options, RM, CM, OptLevel, /*JIT*/ true);
+ auto *TM = TheTarget->createTargetMachine(
+ TT, CPU, Features.getString(), Options, RM, CM, OptLevel, /*JIT*/ true);
if (!TM)
return make_error<StringError>("Could not allocate target machine",
inconvertibleErrorCode());
diff --git a/llvm/lib/ExecutionEngine/TargetSelect.cpp b/llvm/lib/ExecutionEngine/TargetSelect.cpp
index 4ce031d8dc337..e1021f835b51f 100644
--- a/llvm/lib/ExecutionEngine/TargetSelect.cpp
+++ b/llvm/lib/ExecutionEngine/TargetSelect.cpp
@@ -84,10 +84,9 @@ TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple,
}
// Allocate a target...
- TargetMachine *Target =
- TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
- Options, RelocModel, CMModel, OptLevel,
- /*JIT*/ true);
+ TargetMachine *Target = TheTarget->createTargetMachine(
+ TheTriple, MCPU, FeaturesStr, Options, RelocModel, CMModel, OptLevel,
+ /*JIT*/ true);
Target->Options.EmulatedTLS = EmulatedTLS;
assert(Target && "Could not allocate target machine!");
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 7718d8a98172f..8dcebcdb8791d 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -5505,7 +5505,7 @@ createTargetMachine(Function *F, CodeGenOptLevel OptLevel) {
StringRef CPU = F->getFnAttribute("target-cpu").getValueAsString();
StringRef Features = F->getFnAttribute("target-features").getValueAsString();
- const std::string &Triple = M->getTargetTriple().str();
+ const llvm::Triple &Triple = M->getTargetTriple();
std::string Error;
const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error);
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 139c39abf8e6b..1c764a0188eda 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -227,7 +227,7 @@ createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) {
}
std::unique_ptr<TargetMachine> TM(TheTarget->createTargetMachine(
- TheTriple.str(), Conf.CPU, Features.getString(), TargetOpts, RelocModel,
+ TheTriple, Conf.CPU, Features.getString(), TargetOpts, RelocModel,
CodeModel, Conf.CGOptLevel));
assert(TM && "Failed to create target machine");
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index e855b45915521..6b66a88880053 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -420,8 +420,8 @@ bool LTOCodeGenerator::determineTarget() {
std::unique_ptr<TargetMachine> LTOCodeGenerator::createTargetMachine() {
assert(MArch && "MArch is not set!");
return std::unique_ptr<TargetMachine>(MArch->createTargetMachine(
- TripleStr, Config.CPU, FeatureStr, Config.Options, Config.RelocModel,
- std::nullopt, Config.CGOptLevel));
+ Triple(TripleStr), Config.CPU, FeatureStr, Config.Options,
+ Config.RelocModel, std::nullopt, Config.CGOptLevel));
}
// If a linkonce global is present in the MustPreserveSymbols, we need to make
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index 7e13646bfa0a8..d7d2fcce7bd43 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -228,8 +228,8 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
CPU = "cyclone";
}
- TargetMachine *target = march->createTargetMachine(
- Triple.str(), CPU, FeatureStr, options, std::nullopt);
+ TargetMachine *target = march->createTargetMachine(Triple, CPU, FeatureStr,
+ options, std::nullopt);
std::unique_ptr<LTOModule> Ret(new LTOModule(std::move(M), Buffer, target));
Ret->parseSymbols();
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 16326395d0f74..11e88ca4a83eb 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -588,7 +588,7 @@ std::unique_ptr<TargetMachine> TargetMachineBuilder::create() const {
std::string FeatureStr = Features.getString();
std::unique_ptr<TargetMachine> TM(
- TheTarget->createTargetMachine(TheTriple.str(), MCpu, FeatureStr, Options,
+ TheTarget->createTargetMachine(TheTriple, MCpu, FeatureStr, Options,
RelocModel, std::nullopt, CGOptLevel));
assert(TM && "Cannot create target machine");
diff --git a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
index 052dd296265be..145285a31dc10 100644
--- a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
@@ -94,7 +94,7 @@ SPIRVTranslate(Module *M, std::string &SpirvObj, std::string &ErrMsg,
std::optional<Reloc::Model> RM;
std::optional<CodeModel::Model> CM;
std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
- TargetTriple.getTriple(), "", "", Options, RM, CM, OLevel));
+ TargetTriple, "", "", Options, RM, CM, OLevel));
if (!Target) {
ErrMsg = "Could not allocate target machine!";
return false;
diff --git a/llvm/lib/Target/TargetMachineC.cpp b/llvm/lib/Target/TargetMachineC.cpp
index d12fc65047d04..da6d35c8c8b43 100644
--- a/llvm/lib/Target/TargetMachineC.cpp
+++ b/llvm/lib/Target/TargetMachineC.cpp
@@ -197,14 +197,14 @@ void LLVMTargetMachineOptionsSetCodeModel(LLVMTargetMachineOptionsRef Options,
}
LLVMTargetMachineRef
-LLVMCreateTargetMachineWithOptions(LLVMTargetRef T, const char *Triple,
+LLVMCreateTargetMachineWithOptions(LLVMTargetRef T, const char *TripleStr,
LLVMTargetMachineOptionsRef Options) {
auto *Opt = unwrap(Options);
TargetOptions TO;
TO.MCOptions.ABIName = Opt->ABI;
- return wrap(unwrap(T)->createTargetMachine(Triple, Opt->CPU, Opt->Features,
- TO, Opt->RM, Opt->CM, Opt->OL,
- Opt->JIT));
+ return wrap(unwrap(T)->createTargetMachine(Triple(TripleStr), Opt->CPU,
+ Opt->Features, TO, Opt->RM,
+ Opt->CM, Opt->OL, Opt->JIT));
}
LLVMTargetMachineRef
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 456d5f8f2a2f8..9f7824040a37d 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -555,7 +555,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
InitializeOptions(TheTriple);
Target = std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
- TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM, CM, OLvl));
+ TheTriple, CPUStr, FeaturesStr, Options, RM, CM, OLvl));
assert(Target && "Could not allocate target machine!");
return Target->createDataLayout().getStrin...
[truncated]
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/89/builds/18479 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/22293 Here is the relevant piece of the build log for the reference
|
Pulls in these changes: - Fp8/BF8 type conversion ops (llvm/llvm-project#131850) - Accept Triples in createTargetMachine() (llvm/llvm-project#130940) Co-authored-by: Lei Zhang <[email protected]>
In LLVM 21 PR llvm/llvm-project#130940 `TargetRegistry::createTargetMachine` was changed to take a `const Triple&` and has deprecated the old `StringRef` method. @rustbot label llvm-main
In LLVM 21 PR llvm/llvm-project#130940 `TargetRegistry::createTargetMachine` was changed to take a `const Triple&` and has deprecated the old `StringRef` method. @rustbot label llvm-main
PassWrapper: adapt for llvm/llvm-project@f137c3d592e96330e450a8fd63ef… …7e8877fc1908 In LLVM 21 PR llvm/llvm-project#130940 `TargetRegistry::createTargetMachine` was changed to take a `const Triple&` and has deprecated the old `StringRef` method. `@rustbot` label llvm-main
PassWrapper: adapt for llvm/llvm-project@f137c3d592e96330e450a8fd63ef… …7e8877fc1908 In LLVM 21 PR llvm/llvm-project#130940 `TargetRegistry::createTargetMachine` was changed to take a `const Triple&` and has deprecated the old `StringRef` method. ``@rustbot`` label llvm-main
Rollup merge of rust-lang#140534 - erickt:llvm-21, r=cuviper PassWrapper: adapt for llvm/llvm-project@f137c3d592e96330e450a8fd63ef… …7e8877fc1908 In LLVM 21 PR llvm/llvm-project#130940 `TargetRegistry::createTargetMachine` was changed to take a `const Triple&` and has deprecated the old `StringRef` method. ``@rustbot`` label llvm-main
Pulls in these changes: - Fp8/BF8 type conversion ops (llvm/llvm-project#131850) - Accept Triples in createTargetMachine() (llvm/llvm-project#130940) Co-authored-by: Lei Zhang <[email protected]>
@nikic Is there a timeline for how long we want to leave the deprecated wrappers in before removing them? Maybe remove after llvm 22 branches? |
It's fine to drop them now. This deprecation is already part of the LLVM 21 release, so no need to wait another one. (Generally, deprecations are mostly a courtesy for LLVM users that follow main, so they can don't need to be long-lived. We mostly just forget to actually remove them...) |
Ack. I can put up a patch to remove them. Give me like a week to migrate the ~100 or so callsites that are still left internally so we don't get swamped with all the build failures at once. |
This avoids doing a Triple -> std::string -> Triple round trip in lots of places, now that the Module stores a Triple.