[llvm] 2b077ed - [MC] Avoid useless triple copy (#103026)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 03:15:17 PDT 2024
Author: Alexis Engelke
Date: 2024-08-13T12:15:13+02:00
New Revision: 2b077ede083b4185f51a2fe648a27e4c85352a2f
URL: https://github.com/llvm/llvm-project/commit/2b077ede083b4185f51a2fe648a27e4c85352a2f
DIFF: https://github.com/llvm/llvm-project/commit/2b077ede083b4185f51a2fe648a27e4c85352a2f.diff
LOG: [MC] Avoid useless triple copy (#103026)
Copying a triple is cheap, but not free, so let's not do that if there's
no reason to do so. Trivial cleanup.
Added:
Modified:
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/MC/MCObjectFileInfo.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index c2bc1353ee8838..279cfb5aa47d6f 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -525,7 +525,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
TM.getCodeModel() == CodeModel::Large)
return false;
- Triple TargetTriple = TM.getTargetTriple();
+ const Triple &TargetTriple = TM.getTargetTriple();
if (!TargetTriple.isArch64Bit())
return false;
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 6dadd9752646f2..f37e138edc36b1 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -1024,7 +1024,7 @@ void MCObjectFileInfo::initMCObjectFileInfo(MCContext &MCCtx, bool PIC,
DwarfAccelNamespaceSection = nullptr; // Used only by selected targets.
DwarfAccelTypesSection = nullptr; // Used only by selected targets.
- Triple TheTriple = Ctx->getTargetTriple();
+ const Triple &TheTriple = Ctx->getTargetTriple();
switch (Ctx->getObjectFileType()) {
case MCContext::IsMachO:
initMachOMCObjectFileInfo(TheTriple);
More information about the llvm-commits
mailing list