[all-commits] [llvm/llvm-project] 630b6b: clang: Do not overwrite a module's DataLayout in t...
Matt Arsenault via All-commits
all-commits at lists.llvm.org
Wed Sep 16 10:30:10 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 630b6b92235ea34a50efd1c4d9f101af25547141
https://github.com/llvm/llvm-project/commit/630b6b92235ea34a50efd1c4d9f101af25547141
Author: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: 2026-09-16 (Wed, 16 Sep 2026)
Changed paths:
M clang/include/clang/CodeGen/BackendUtil.h
M clang/lib/CIR/FrontendAction/CIRGenAction.cpp
M clang/lib/CodeGen/BackendUtil.cpp
M clang/lib/CodeGen/CodeGenAction.cpp
M clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
A clang/test/CodeGen/Inputs/riscv-ilp32e-no-datalayout.ll
M clang/test/CodeGen/PR44896.ll
M clang/test/CodeGen/asan-unified-lto.ll
A clang/test/CodeGen/riscv-ir-datalayout-preserve.ll
M lldb/test/API/functionalities/inline-sourcefile/inline.ll
Log Message:
-----------
clang: Do not overwrite a module's DataLayout in the backend (#224012)
emitAssembly() unconditionally reset the module's DataLayout from
TargetMachine::createDataLayout(). The TargetMachine's DataLayout is
unreliable given the existence of the "target-abi" module flag, so it
should not be used.
For -x ir input modules this would discard the correct datalayout in
favor of a possibly wrong one.
The post-codegen consistency check compared the module's DataLayout
against clang's frontend getDataLayoutString(), which likewise ignores the
target-abi flag. Recompute the expected layout from the module's own ABI via
Triple::computeDataLayout(getTargetABIName(M)) so the check stays
meaningful without assuming the DataLayout is a fixed property of the target
options. This still detects frontend/LLVM DataLayout drift for generated modules.
PR44896.ll and asan-unified-lto.ll declared x86_64 modules but ran without an
explicit triple, relying on the old overwrite to convert them to the default target.
Pin them to their declared triple and refresh their stale DataLayout strings.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
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