summaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOCodeGenerator.cpp
diff options
context:
space:
mode:
authorAiden Grossman <aidengrossman@google.com>2025-09-12 01:05:48 +0000
committerAiden Grossman <aidengrossman@google.com>2025-09-12 01:05:48 +0000
commit88a52e1fc6d3e153132f0e0a86431762adf8c0c4 (patch)
treebae8c1b720736edc54705c325c5bfb95b459eda2 /llvm/lib/LTO/LTOCodeGenerator.cpp
parent1873dd7e8bb03319500a9f4b51e9e498a8fb70de (diff)
parent2740e4b73682eb7a6869c333991a608304938952 (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/boomanaiden154/main.clang-invoke-shell-script-with-bash
Created using spr 1.3.6 [skip ci]
Diffstat (limited to 'llvm/lib/LTO/LTOCodeGenerator.cpp')
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 09b91d81225a..d8a96f73110f 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -375,16 +375,12 @@ bool LTOCodeGenerator::determineTarget() {
if (TargetMach)
return true;
- TripleStr = MergedModule->getTargetTriple().str();
- llvm::Triple Triple(TripleStr);
- if (TripleStr.empty()) {
- TripleStr = sys::getDefaultTargetTriple();
- MergedModule->setTargetTriple(Triple);
- }
+ if (MergedModule->getTargetTriple().empty())
+ MergedModule->setTargetTriple(Triple(sys::getDefaultTargetTriple()));
// create target machine from info for merged modules
std::string ErrMsg;
- MArch = TargetRegistry::lookupTarget(TripleStr, ErrMsg);
+ MArch = TargetRegistry::lookupTarget(MergedModule->getTargetTriple(), ErrMsg);
if (!MArch) {
emitError(ErrMsg);
return false;
@@ -393,10 +389,10 @@ bool LTOCodeGenerator::determineTarget() {
// Construct LTOModule, hand over ownership of module and target. Use MAttr as
// the default set of features.
SubtargetFeatures Features(join(Config.MAttrs, ""));
- Features.getDefaultSubtargetFeatures(Triple);
+ Features.getDefaultSubtargetFeatures(MergedModule->getTargetTriple());
FeatureStr = Features.getString();
if (Config.CPU.empty())
- Config.CPU = lto::getThinLTODefaultCPU(Triple);
+ Config.CPU = lto::getThinLTODefaultCPU(MergedModule->getTargetTriple());
// If data-sections is not explicitly set or unset, set data-sections by
// default to match the behaviour of lld and gold plugin.
@@ -412,7 +408,7 @@ bool LTOCodeGenerator::determineTarget() {
std::unique_ptr<TargetMachine> LTOCodeGenerator::createTargetMachine() {
assert(MArch && "MArch is not set!");
return std::unique_ptr<TargetMachine>(MArch->createTargetMachine(
- Triple(TripleStr), Config.CPU, FeatureStr, Config.Options,
+ MergedModule->getTargetTriple(), Config.CPU, FeatureStr, Config.Options,
Config.RelocModel, std::nullopt, Config.CGOptLevel));
}