[all-commits] [llvm/llvm-project] 979c27: [IR] Store Triple in Module (NFC) (#129868)

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Mar 6 01:28:10 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 979c275097a642e9b96c6b0a12f013c831af3a6e
      https://github.com/llvm/llvm-project/commit/979c275097a642e9b96c6b0a12f013c831af3a6e
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-03-06 (Thu, 06 Mar 2025)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/CodeGen/CodeGenAction.cpp
    M clang/lib/CodeGen/ModuleBuilder.cpp
    M clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
    M clang/lib/Interpreter/DeviceOffload.cpp
    M clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
    M clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
    M clang/unittests/Interpreter/InterpreterExtensionsTest.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    M lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
    M lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
    M llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
    M llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/include/llvm/IR/Module.h
    M llvm/include/llvm/LTO/legacy/LTOModule.h
    M llvm/include/llvm/MC/TargetRegistry.h
    M llvm/include/llvm/TargetParser/Triple.h
    M llvm/lib/Analysis/DXILMetadataAnalysis.cpp
    M llvm/lib/Analysis/Lint.cpp
    M llvm/lib/Analysis/TargetLibraryInfo.cpp
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    M llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
    M llvm/lib/CodeGen/GlobalMerge.cpp
    M llvm/lib/CodeGen/MIRParser/MIRParser.cpp
    M llvm/lib/CodeGen/StackProtector.cpp
    M llvm/lib/CodeGen/WinEHPrepare.cpp
    M llvm/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
    M llvm/lib/ExecutionEngine/TargetSelect.cpp
    M llvm/lib/Frontend/Offloading/OffloadWrapper.cpp
    M llvm/lib/Frontend/Offloading/Utility.cpp
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M llvm/lib/IR/AsmWriter.cpp
    M llvm/lib/IR/Core.cpp
    M llvm/lib/IR/EHPersonalities.cpp
    M llvm/lib/IR/Globals.cpp
    M llvm/lib/IR/ValueSymbolTable.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/LTO/LTO.cpp
    M llvm/lib/LTO/LTOBackend.cpp
    M llvm/lib/LTO/LTOCodeGenerator.cpp
    M llvm/lib/LTO/LTOModule.cpp
    M llvm/lib/LTO/ThinLTOCodeGenerator.cpp
    M llvm/lib/LTO/UpdateCompilerUsed.cpp
    M llvm/lib/Linker/IRMover.cpp
    M llvm/lib/MC/TargetRegistry.cpp
    M llvm/lib/Object/ELFObjectFile.cpp
    M llvm/lib/Object/IRObjectFile.cpp
    M llvm/lib/Object/IRSymtab.cpp
    M llvm/lib/Object/ModuleSymbolTable.cpp
    M llvm/lib/ProfileData/InstrProf.cpp
    M llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
    M llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
    M llvm/lib/Target/AArch64/AArch64StackTagging.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
    M llvm/lib/Target/DirectX/DXILOpBuilder.cpp
    M llvm/lib/Target/DirectX/DXILOpLowering.cpp
    M llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
    M llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
    M llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
    M llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
    M llvm/lib/Target/SPIRV/SPIRVAPI.cpp
    M llvm/lib/Target/X86/X86MCInstLower.cpp
    M llvm/lib/Transforms/CFGuard/CFGuard.cpp
    M llvm/lib/Transforms/Coroutines/CoroSplit.cpp
    M llvm/lib/Transforms/IPO/Internalize.cpp
    M llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    M llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
    M llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
    M llvm/lib/Transforms/Instrumentation/InstrOrderFile.cpp
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
    M llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
    M llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
    M llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
    M llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
    M llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp
    M llvm/tools/bugpoint/BugDriver.cpp
    M llvm/tools/llc/llc.cpp
    M llvm/tools/lli/lli.cpp
    M llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
    M llvm/tools/llvm-exegesis/lib/Assembler.cpp
    M llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
    M llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
    M llvm/tools/lto/lto.cpp
    M llvm/tools/opt/optdriver.cpp
    M llvm/unittests/Analysis/LazyCallGraphTest.cpp
    M llvm/unittests/DebugInfo/DWARF/DwarfUtils.cpp
    M llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
    M llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
    M llvm/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h
    M llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.cpp
    M llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
    M llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
    M llvm/unittests/IR/LegacyPassManagerTest.cpp
    M llvm/unittests/Target/AArch64/InstSizes.cpp
    M llvm/unittests/Target/ARM/InstSizes.cpp
    M llvm/unittests/Target/LoongArch/InstSizes.cpp
    M llvm/unittests/Target/X86/MachineSizeOptsTest.cpp
    M llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
    M llvm/unittests/tools/llvm-mca/MCATestBase.cpp
    M mlir/lib/ExecutionEngine/ExecutionEngine.cpp
    M mlir/lib/Target/LLVM/ModuleToObject.cpp
    M mlir/lib/Target/LLVMIR/ModuleImport.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M offload/plugins-nextgen/common/src/PluginInterface.cpp
    M polly/lib/CodeGen/IslNodeBuilder.cpp
    M polly/lib/CodeGen/PerfMonitor.cpp

  Log Message:
  -----------
  [IR] Store Triple in Module (NFC) (#129868)

The module currently stores the target triple as a string. This means
that any code that wants to actually use the triple first has to
instantiate a Triple, which is somewhat expensive. The change in #121652
caused a moderate compile-time regression due to this. While it would be
easy enough to work around, I think that architecturally, it makes more
sense to store the parsed Triple in the module, so that it can always be
directly queried.

For this change, I've opted not to add any magic conversions between
std::string and Triple for backwards-compatibilty purses, and instead
write out needed Triple()s or str()s explicitly. This is because I think
a decent number of them should be changed to work on Triple as well, to
avoid unnecessary conversions back and forth.

The only interesting part in this patch is that the default triple is
Triple("") instead of Triple() to preserve existing behavior. The former
defaults to using the ELF object format instead of unknown object
format. We should fix that as well.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list