Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f137c3d

Browse files
authoredMar 12, 2025··
[TargetRegistry] Accept Triple in createTargetMachine() (NFC) (#130940)
This avoids doing a Triple -> std::string -> Triple round trip in lots of places, now that the Module stores a Triple.
1 parent 71582c6 commit f137c3d

File tree

62 files changed

+134
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+134
-120
lines changed
 

‎bolt/lib/Passes/AsmDump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void dumpFunction(const BinaryFunction &BF) {
143143
std::move(MCEInstance.MCE), std::move(MAB)));
144144
AsmStreamer->initSections(true, *BC.STI);
145145
std::unique_ptr<TargetMachine> TM(BC.TheTarget->createTargetMachine(
146-
BC.TripleName, "", "", TargetOptions(), std::nullopt));
146+
*BC.TheTriple, "", "", TargetOptions(), std::nullopt));
147147
std::unique_ptr<AsmPrinter> MAP(
148148
BC.TheTarget->createAsmPrinter(*TM, std::move(AsmStreamer)));
149149

‎clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) {
595595
void EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
596596
// Create the TargetMachine for generating code.
597597
std::string Error;
598-
std::string Triple = TheModule->getTargetTriple().str();
598+
const llvm::Triple &Triple = TheModule->getTargetTriple();
599599
const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error);
600600
if (!TheTarget) {
601601
if (MustCreateTM)

0 commit comments

Comments
 (0)
Please sign in to comment.