[llvm] eb68cbb - Fix big endian build bots
Chris Bieneman via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 17:27:33 PDT 2022
Author: Chris Bieneman
Date: 2022-06-06T19:27:23-05:00
New Revision: eb68cbb405512b448a2f3336e102982c144ad4e9
URL: https://github.com/llvm/llvm-project/commit/eb68cbb405512b448a2f3336e102982c144ad4e9
DIFF: https://github.com/llvm/llvm-project/commit/eb68cbb405512b448a2f3336e102982c144ad4e9.diff
LOG: Fix big endian build bots
Another case of reading a value from a struct that has been byte
swapped to write out. This should address the failure on the ppcbe bot.
Added:
Modified:
llvm/lib/ObjectYAML/DXContainerEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
index e3ab1ef9f7a6e..260e059415cdf 100644
--- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
@@ -144,14 +144,15 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
Header.Size = P.Program->Size.getValue();
else
Header.Size = sizeof(dxbc::ProgramHeader) + Header.Bitcode.Size;
+
+ uint32_t BitcodeOffset = Header.Bitcode.Offset;
if (sys::IsBigEndianHost)
Header.swapBytes();
OS.write(reinterpret_cast<const char *>(&Header),
sizeof(dxbc::ProgramHeader));
if (P.Program->DXIL) {
- if (Header.Bitcode.Offset > sizeof(dxbc::BitcodeHeader)) {
- uint32_t PadBytes =
- Header.Bitcode.Offset - sizeof(dxbc::BitcodeHeader);
+ if (BitcodeOffset > sizeof(dxbc::BitcodeHeader)) {
+ uint32_t PadBytes = BitcodeOffset - sizeof(dxbc::BitcodeHeader);
OS.write_zeros(PadBytes);
}
OS.write(reinterpret_cast<char *>(P.Program->DXIL->data()),
More information about the llvm-commits
mailing list