[llvm] [NVPTX] Fix DwarfFrameBase construction (PR #101000)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 04:37:22 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-nvptx

Author: Nikita Popov (nikic)

<details>
<summary>Changes</summary>

The `{0}` here was initializing the first union member `Register`, rather than the union member used by CFA, which is `Offset`. Prior to https://github.com/llvm/llvm-project/pull/99263 this was harmless, but now they have different layout, leading to test failures on some platforms (at least i686 and s390x).

---
Full diff: https://github.com/llvm/llvm-project/pull/101000.diff


1 Files Affected:

- (modified) llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp (+4-1) 


``````````diff
diff --git a/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp
index 10ae81e0460e3..9abe0e3186f20 100644
--- a/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp
@@ -93,5 +93,8 @@ MachineBasicBlock::iterator NVPTXFrameLowering::eliminateCallFramePseudoInstr(
 
 TargetFrameLowering::DwarfFrameBase
 NVPTXFrameLowering::getDwarfFrameBase(const MachineFunction &MF) const {
-  return {DwarfFrameBase::CFA, {0}};
+  DwarfFrameBase FrameBase;
+  FrameBase.Kind = DwarfFrameBase::CFA;
+  FrameBase.Location.Offset = 0;
+  return FrameBase;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/101000


More information about the llvm-commits mailing list