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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 04:36:49 PDT 2024


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

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).

>From e57900adc295448a53c33b786d3c2b1af76ed650 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Mon, 29 Jul 2024 12:29:07 +0200
Subject: [PATCH] [NVPTX] Fix DwarfFrameBase construction

The `{0}` here was initializing the first union member `Register`,
rather than the union member used by CFA, which is `Location`.
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.
---
 llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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;
 }



More information about the llvm-commits mailing list