Skip to content

[amdgpu-cfi: 5/9]: [AMDGPU] Implement CFI for non-kernel functions - #183153

Merged
slinder1 merged 5 commits into
mainfrom
users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373
May 26, 2026
Merged

slinder1 merged 5 commits into
mainfrom
users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373

Conversation

@slinder1

@slinder1 slinder1 commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown

🐧 Linux x64 Test Results

  • 195769 tests passed
  • 5259 tests skipped

✅ The build succeeded and all tests passed.

@slinder1
slinder1 force-pushed the users/slinder1/I21580f6a24f4869ba32939c9c6332506032cc654 branch from 97a81b4 to a77b5c2 Compare February 24, 2026 21:41
@slinder1
slinder1 force-pushed the users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373 branch from e4f5784 to 9dc067f Compare February 24, 2026 21:41
@slinder1 slinder1 changed the title [4/8]: [AMDGPU] Implement CFI for non-kernel functions [5/9]: [AMDGPU] Implement CFI for non-kernel functions Feb 24, 2026
@slinder1
slinder1 force-pushed the users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373 branch from 9dc067f to 36fa2c3 Compare February 24, 2026 22:13
@slinder1

Copy link
Copy Markdown
Contributor Author

Changes since last push:

diff --git b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -329,14 +329,14 @@ class PrologEpilogSGPRSpillBuilder {
   /// SubReg spill, as each SubReg maps directly to a CFI register via
   /// getDwarfRegNum(SubReg, false). All other cases currently currently
   /// correspond to the SuperReg directly.
-  std::optional<Register> getCFISuperReg() const {
+  MCRegister getCFISuperReg() const {
     if (IsFramePtrPrologSpill)
       return FuncInfo->getFrameOffsetReg();
     // FIXME: CFI for EXEC needs a fix by accurately computing the spill
     // offset for both the low and high components.
     if (isExec(SuperReg))
       return AMDGPU::EXEC;
-    return std::nullopt;
+    return {};
   }
 
   void saveToMemory(const int FI) const {
@@ -357,7 +357,7 @@ class PrologEpilogSGPRSpillBuilder {
                         nullptr, MCRI->getDwarfRegNum(Reg, false),
                         MFI.getObjectOffset(FI) * ST.getWavefrontSize()));
     };
-    std::optional<Register> CFISuperReg = getCFISuperReg();
+    MCRegister CFISuperReg = getCFISuperReg();
     for (unsigned I = 0, DwordOff = 0; I < NumSubRegs; ++I) {
       Register SubReg = NumSubRegs == 1
                             ? SuperReg
@@ -372,7 +372,7 @@ class PrologEpilogSGPRSpillBuilder {
       DwordOff += 4;
     }
     if (NeedsFrameMoves && CFISuperReg)
-      BuildCFI(*CFISuperReg);
+      BuildCFI(CFISuperReg);
   }
 
   void saveToVGPRLane(const int FI) const {
@@ -383,7 +383,7 @@ class PrologEpilogSGPRSpillBuilder {
         FuncInfo->getSGPRSpillToPhysicalVGPRLanes(FI);
     assert(Spill.size() == NumSubRegs);
 
-    std::optional<Register> CFISuperReg = getCFISuperReg();
+    MCRegister CFISuperReg = getCFISuperReg();
     for (unsigned I = 0; I < NumSubRegs; ++I) {
       Register SubReg = NumSubRegs == 1
                             ? SuperReg
@@ -394,11 +394,11 @@ class PrologEpilogSGPRSpillBuilder {
           .addImm(Spill[I].Lane)
           .addReg(Spill[I].VGPR, RegState::Undef);
       if (NeedsFrameMoves && !CFISuperReg)
-          TFI->buildCFIForSGPRToVGPRSpill(MBB, MI, DL, SubReg, Spill[I].VGPR,
-                                          Spill[I].Lane);
+        TFI->buildCFIForSGPRToVGPRSpill(MBB, MI, DL, SubReg, Spill[I].VGPR,
+                                        Spill[I].Lane);
     }
     if (NeedsFrameMoves && CFISuperReg)
-      TFI->buildCFIForSGPRToVGPRSpill(MBB, MI, DL, *CFISuperReg, Spill);
+      TFI->buildCFIForSGPRToVGPRSpill(MBB, MI, DL, CFISuperReg, Spill);
   }
 
   void copyToScratchSGPR(Register DstReg) const {
@@ -411,12 +411,12 @@ class PrologEpilogSGPRSpillBuilder {
       unsigned DstNumSubRegs = DstSplitParts.empty() ? 1 : DstSplitParts.size();
       assert(NumSubRegs == DstNumSubRegs);
       for (unsigned I = 0; I < NumSubRegs; ++I) {
-        Register SrcSubReg =
-            NumSubRegs == 1 ? SuperReg
-                            : Register(TRI.getSubReg(SuperReg, SplitParts[I]));
-        Register DstSubReg =
-            NumSubRegs == 1 ? DstReg
-                            : Register(TRI.getSubReg(DstReg, DstSplitParts[I]));
+        MCRegister SrcSubReg = NumSubRegs == 1
+                                   ? MCRegister(SuperReg)
+                                   : TRI.getSubReg(SuperReg, SplitParts[I]);
+        MCRegister DstSubReg = NumSubRegs == 1
+                                   ? MCRegister(DstReg)
+                                   : TRI.getSubReg(DstReg, DstSplitParts[I]);
         if (isExec(SuperReg)) {
           if (I == NumSubRegs - 1)
             TFI->buildCFIForRegToSGPRPairSpill(MBB, MI, DL, AMDGPU::EXEC,
@@ -442,9 +442,9 @@ class PrologEpilogSGPRSpillBuilder {
       report_fatal_error("failed to find free scratch register");
 
     for (unsigned I = 0, DwordOff = 0; I < NumSubRegs; ++I) {
-      Register SubReg = NumSubRegs == 1
-                            ? SuperReg
-                            : Register(TRI.getSubReg(SuperReg, SplitParts[I]));
+      MCRegister SubReg = NumSubRegs == 1
+                              ? MCRegister(SuperReg)
+                              : TRI.getSubReg(SuperReg, SplitParts[I]);
 
       buildEpilogRestore(ST, TRI, *FuncInfo, LiveUnits, MF, MBB, MI, DL,
                          TmpVGPR, FI, FrameReg, DwordOff);
@@ -463,9 +463,9 @@ class PrologEpilogSGPRSpillBuilder {
     assert(Spill.size() == NumSubRegs);
 
     for (unsigned I = 0; I < NumSubRegs; ++I) {
-      Register SubReg = NumSubRegs == 1
-                            ? SuperReg
-                            : Register(TRI.getSubReg(SuperReg, SplitParts[I]));
+      MCRegister SubReg = NumSubRegs == 1
+                              ? MCRegister(SuperReg)
+                              : TRI.getSubReg(SuperReg, SplitParts[I]);
       BuildMI(MBB, MI, DL, TII->get(AMDGPU::SI_RESTORE_S32_FROM_VGPR), SubReg)
           .addReg(Spill[I].VGPR)
           .addImm(Spill[I].Lane);
@@ -2517,16 +2517,15 @@ MachineInstr *SIFrameLowering::buildCFIForRegToSGPRPairSpill(
     MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
     const DebugLoc &DL, const Register Reg, const Register SGPRPair) const {
   const MachineFunction &MF = *MBB.getParent();
-  const MCRegisterInfo &MCRI = *MF.getContext().getRegisterInfo();
   const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
   const SIRegisterInfo &TRI = ST.getInstrInfo()->getRegisterInfo();
 
   MCRegister SGPR0 = TRI.getSubReg(SGPRPair, AMDGPU::sub0);
   MCRegister SGPR1 = TRI.getSubReg(SGPRPair, AMDGPU::sub1);
 
-  int DwarfReg = MCRI.getDwarfRegNum(Reg, false);
-  int DwarfSGPR0 = MCRI.getDwarfRegNum(SGPR0, false);
-  int DwarfSGPR1 = MCRI.getDwarfRegNum(SGPR1, false);
+  int DwarfReg = TRI.getDwarfRegNum(Reg, false);
+  int DwarfSGPR0 = TRI.getDwarfRegNum(SGPR0, false);
+  int DwarfSGPR1 = TRI.getDwarfRegNum(SGPR1, false);
   assert(DwarfReg != -1 && DwarfSGPR0 != 1 && DwarfSGPR1 != 1);
 
   auto CFIInst = MCCFIInstruction::createLLVMRegisterPair(

@slinder1
slinder1 force-pushed the users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373 branch from 36fa2c3 to e25ca09 Compare February 25, 2026 20:58
@slinder1
slinder1 force-pushed the users/slinder1/I21580f6a24f4869ba32939c9c6332506032cc654 branch from a77b5c2 to 2e8751f Compare February 25, 2026 20:58
@slinder1 slinder1 changed the title [5/9]: [AMDGPU] Implement CFI for non-kernel functions [amdgpu-cfi: 5/9]: [AMDGPU] Implement CFI for non-kernel functions Feb 25, 2026
@slinder1
slinder1 force-pushed the users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373 branch from e25ca09 to aeeedc7 Compare February 26, 2026 21:21
@slinder1

Copy link
Copy Markdown
Contributor Author

Changes since last push:

diff --git b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -96,7 +96,7 @@ createScaledCFAInPrivateWave(const GCNSubtarget &ST,
 
 void SIFrameLowering::emitDefCFA(MachineBasicBlock &MBB,
                                  MachineBasicBlock::iterator MBBI,
-                                 DebugLoc const &DL, Register StackPtrReg,
+                                 DebugLoc const &DL, MCRegister StackPtrReg,
                                  bool AspaceAlreadyDefined,
                                  MachineInstr::MIFlag Flags) const {
   MachineFunction &MF = *MBB.getParent();
@@ -1112,7 +1112,7 @@ void SIFrameLowering::emitPrologueEntryCFI(MachineBasicBlock &MBB,
   const MCRegisterInfo *MCRI = MF.getContext().getRegisterInfo();
   const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
   const SIRegisterInfo &TRI = ST.getInstrInfo()->getRegisterInfo();
-  Register StackPtrReg =
+  MCRegister StackPtrReg =
       MF.getInfo<SIMachineFunctionInfo>()->getStackPtrOffsetReg();
 
   emitDefCFA(MBB, MBBI, DL, StackPtrReg, /*AspaceAlreadyDefined=*/true,
@@ -2464,7 +2464,7 @@ MachineInstr *SIFrameLowering::buildCFI(MachineBasicBlock &MBB,
 
 MachineInstr *SIFrameLowering::buildCFIForSGPRToVGPRSpill(
     MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    const DebugLoc &DL, const Register SGPR, const Register VGPR,
+    const DebugLoc &DL, const MCRegister SGPR, const MCRegister VGPR,
     const int Lane) const {
   const MachineFunction &MF = *MBB.getParent();
   const MCRegisterInfo &MCRI = *MF.getContext().getRegisterInfo();
@@ -2485,7 +2485,7 @@ MachineInstr *SIFrameLowering::buildCFIForSGPRToVGPRSpill(
 
 MachineInstr *SIFrameLowering::buildCFIForSGPRToVGPRSpill(
     MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    const DebugLoc &DL, Register SGPR,
+    const DebugLoc &DL, MCRegister SGPR,
     ArrayRef<SIRegisterInfo::SpilledReg> VGPRSpills) const {
   if (VGPRSpills.size() == 1u)
     return buildCFIForSGPRToVGPRSpill(MBB, MBBI, DL, SGPR, VGPRSpills[0].VGPR,
@@ -2515,7 +2515,7 @@ MachineInstr *SIFrameLowering::buildCFIForSGPRToVGPRSpill(
 
 MachineInstr *SIFrameLowering::buildCFIForRegToSGPRPairSpill(
     MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    const DebugLoc &DL, const Register Reg, const Register SGPRPair) const {
+    const DebugLoc &DL, const MCRegister Reg, const MCRegister SGPRPair) const {
   const MachineFunction &MF = *MBB.getParent();
   const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
   const SIRegisterInfo &TRI = ST.getInstrInfo()->getRegisterInfo();
diff --git b/llvm/lib/Target/AMDGPU/SIFrameLowering.h a/llvm/lib/Target/AMDGPU/SIFrameLowering.h
@@ -106,7 +106,7 @@ private:
                             const DebugLoc &DL) const;
 
   void emitDefCFA(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-                  DebugLoc const &DL, Register StackPtrReg,
+                  DebugLoc const &DL, MCRegister StackPtrReg,
                   bool AspaceAlreadyDefined,
                   MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const;
 
@@ -124,19 +124,20 @@ public:
   MachineInstr *buildCFIForSGPRToVGPRSpill(MachineBasicBlock &MBB,
                                            MachineBasicBlock::iterator MBBI,
                                            const DebugLoc &DL,
-                                           const Register SGPR,
-                                           const Register VGPR,
+                                           const MCRegister SGPR,
+                                           const MCRegister VGPR,
                                            const int Lane) const;
   /// Create a CFI index describing a spill of an SGPR to multiple lanes of
   /// VGPRs and build a MachineInstr around it.
   MachineInstr *buildCFIForSGPRToVGPRSpill(
       MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-      const DebugLoc &DL, Register SGPR,
+      const DebugLoc &DL, MCRegister SGPR,
       ArrayRef<SIRegisterInfo::SpilledReg> VGPRSpills) const;
   MachineInstr *buildCFIForRegToSGPRPairSpill(MachineBasicBlock &MBB,
                                               MachineBasicBlock::iterator MBBI,
-                                              const DebugLoc &DL, Register Reg,
-                                              Register SGPRPair) const;
+                                              const DebugLoc &DL,
+                                              MCRegister Reg,
+                                              MCRegister SGPRPair) const;
   // Returns true if the function may need to reserve space on the stack for the
   // CWSR trap handler.
   bool mayReserveScratchForCWSR(const MachineFunction &MF) const;

Base automatically changed from users/slinder1/I21580f6a24f4869ba32939c9c6332506032cc654 to main May 26, 2026 20:07
slinder1 and others added 5 commits May 26, 2026 20:08
Previously we effectively took the absolute value of the APSInt, instead
diagnose the unexpected negative value.

Change-Id: I4efe961e7b29fdf1d5f97df12f8139aac12c9219
While these can be represented with .cfi_escape, using these pseudo-cfi
instructions makes .s/.mir files more readable, and it is necessary to
support updating registers in CFI instructions (something that the
AMDGPU backend requires).

Change-Id: I763d0cabe5990394670281d4afb5a170981e55d0
To avoid codegen changes when enabling debug-info (see
https://bugs.llvm.org/show_bug.cgi?id=37240) we want to
enable unwind tables by default.

There is some pessimization in post-prologepilog scheduling, and a
general solution to the problem of CFI_INSTRUCTION-as-scheduling-barrier
should be explored.

Change-Id: I83625875966928c7c4411cd7b95174dc58bda25a
Entry functions represent the end of unwinding, as they are the
outer-most frame. This implies they can only have a meaningful
definition for the CFA, which AMDGPU defines using a memory location
description with a literal private address space address. The return
address is set to undefined as a sentinel value to signal the end of
unwinding.

Change-Id: I21580f6a24f4869ba32939c9c6332506032cc654
Co-authored-by: Scott Linder <scott.linder@amd.com>
Co-authored-by: Venkata Ramanaiah Nalamothu <VenkataRamanaiah.Nalamothu@amd.com>
This does not implement CSR spills other than those AMDGPU handles
during PEI. The remaining spills are handled in a subsequent patch.

Change-Id: I5e3a9a62cf9189245011a82a129790d813d49373
Co-authored-by: Scott Linder <scott.linder@amd.com>
Co-authored-by: Venkata Ramanaiah Nalamothu <VenkataRamanaiah.Nalamothu@amd.com>
@slinder1
slinder1 force-pushed the users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373 branch from 0fd81b2 to bd8d788 Compare May 26, 2026 20:08
@slinder1

Copy link
Copy Markdown
Contributor Author

🛠️ Changes since last push: none (likely a rebase)

@slinder1
slinder1 merged commit f78a233 into main May 26, 2026
13 of 17 checks passed
@slinder1
slinder1 deleted the users/slinder1/I5e3a9a62cf9189245011a82a129790d813d49373 branch May 26, 2026 20:57
@slinder1

Copy link
Copy Markdown
Contributor Author

🛠️ Changes since last push: none (likely a rebase)

@llvm-ci

llvm-ci commented May 26, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder release-noassertions-warnings running on google-integrate-b2 while building llvm at step 6 "build-default".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/228/builds/105

Here is the relevant piece of the build log for the reference
Step 6 (build-default) failure: cmake (failure)
...
87.488 [1344/34/7195] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineScheduler.cpp.o
87.656 [1343/34/7196] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPUSplitModule.cpp.o
88.706 [1342/34/7197] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIInsertHardClauses.cpp.o
88.730 [1341/34/7198] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPUISelDAGToDAG.cpp.o
89.233 [1340/34/7199] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIAnnotateControlFlow.cpp.o
89.588 [1339/34/7200] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/GCNRegPressure.cpp.o
89.829 [1338/34/7201] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPURegBankLegalizeRules.cpp.o
89.977 [1337/34/7202] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/GCNHazardRecognizer.cpp.o
90.283 [1336/34/7203] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/GCNSubtarget.cpp.o
90.999 [1335/34/7204] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFrameLowering.cpp.o
FAILED: lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFrameLowering.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/c++ -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/release-noassertions-warnings-build/build/lib/Target/AMDGPU -I/b/release-noassertions-warnings-build/llvm-project/llvm/lib/Target/AMDGPU -I/b/release-noassertions-warnings-build/build/include -I/b/release-noassertions-warnings-build/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -O3 -DNDEBUG -std=c++17 -fvisibility=hidden -fno-exceptions -funwind-tables -fno-rtti -Winvalid-pch -Xclang -include-pch -Xclang /b/release-noassertions-warnings-build/build/lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /b/release-noassertions-warnings-build/build/lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/cmake_pch.hxx -MD -MT lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFrameLowering.cpp.o -MF lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFrameLowering.cpp.o.d -o lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFrameLowering.cpp.o -c /b/release-noassertions-warnings-build/llvm-project/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
/b/release-noassertions-warnings-build/llvm-project/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:412:16: error: unused variable 'DstNumSubRegs' [-Werror,-Wunused-variable]
  412 |       unsigned DstNumSubRegs = DstSplitParts.empty() ? 1 : DstSplitParts.size();
      |                ^~~~~~~~~~~~~
1 error generated.
91.135 [1335/33/7205] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIModeRegisterDefaults.cpp.o
91.374 [1335/32/7206] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFormMemoryClauses.cpp.o
91.788 [1335/31/7207] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/R600ISelLowering.cpp.o
91.806 [1335/30/7208] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFoldOperands.cpp.o
91.907 [1335/29/7209] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIFixSGPRCopies.cpp.o
92.097 [1335/28/7210] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIModeRegister.cpp.o
92.225 [1335/27/7211] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SILoadStoreOptimizer.cpp.o
92.425 [1335/26/7212] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMemoryLegalizer.cpp.o
92.562 [1335/25/7213] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SILateBranchLowering.cpp.o
92.621 [1335/24/7214] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SILowerI1Copies.cpp.o
92.925 [1335/23/7215] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SILowerWWMCopies.cpp.o
92.983 [1335/22/7216] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIOptimizeExecMasking.cpp.o
93.515 [1335/21/7217] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPUTargetTransformInfo.cpp.o
93.694 [1335/20/7218] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SILowerControlFlow.cpp.o
93.708 [1335/19/7219] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/R600TargetTransformInfo.cpp.o
93.991 [1335/18/7220] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SILowerSGPRSpills.cpp.o
94.198 [1335/17/7221] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIOptimizeExecMaskingPreRA.cpp.o
94.416 [1335/16/7222] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIPostRABundler.cpp.o
94.423 [1335/15/7223] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/GCNSchedStrategy.cpp.o
94.554 [1335/14/7224] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIMachineFunctionInfo.cpp.o
94.677 [1335/13/7225] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIPeepholeSDWA.cpp.o
94.866 [1335/12/7226] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIPreEmitPeephole.cpp.o
95.540 [1335/11/7227] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIInsertWaitcnts.cpp.o
95.699 [1335/10/7228] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIPreAllocateWWMRegs.cpp.o
96.113 [1335/9/7229] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIOptimizeVGPRLiveRange.cpp.o
96.189 [1335/8/7230] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/R600ISelDAGToDAG.cpp.o
97.257 [1335/7/7231] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/R600TargetMachine.cpp.o
97.553 [1335/6/7232] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIInstrInfo.cpp.o
97.671 [1335/5/7233] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
101.355 [1335/4/7234] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/SIISelLowering.cpp.o
105.658 [1335/3/7235] Building CXX object lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/SLPVectorizer.cpp.o
106.233 [1335/2/7236] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPUInstructionSelector.cpp.o
110.514 [1335/1/7237] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPUTargetMachine.cpp.o

slinder1 added a commit that referenced this pull request May 26, 2026
Attempt at fixing issues in #183153 caught by buildbots, specifically
no-assert and windows builds.

Not sure how to run those bots ahead of landing this?

Change-Id: I285adf09ac2df239d0ab05459f7388b6970247ad
schuermans-roofline added a commit to iree-org/llvm-project that referenced this pull request May 27, 2026
This is a fix for "[AMDGPU] Implement CFI for non-kernel functions (llvm#183153)"
f78a233 to use "SuperReg.asMCReg()" instead
of "MCRegister(SuperReg)", which leads to "ambiguous call" when using the
MSVC compiler.
if (NeedsFrameMoves) {
const TargetRegisterClass *RC = TRI.getPhysRegBaseClass(DstReg);
ArrayRef<int16_t> DstSplitParts = TRI.getRegSplitParts(RC, EltSize);
unsigned DstNumSubRegs = DstSplitParts.empty() ? 1 : DstSplitParts.size();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @slinder1
DstNumSubRegs is unused in builds without asserts:

/repo/llvm/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:412:16: error: unused variable 'DstNumSubRegs' [-Werror,-Wunused-variable]
  412 |       unsigned DstNumSubRegs = DstSplitParts.empty() ? 1 : DstSplitParts.size();
      |                ^~~~~~~~~~~~~
1 error generated.

? SuperReg
: Register(TRI.getSubReg(SuperReg, SplitParts[I]));
MCRegister SubReg = NumSubRegs == 1
? MCRegister(SuperReg)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slinder1
MSVC is complaining:

error C2440: '<function-style-cast>': cannot convert from 'llvm::Register' to 'llvm::MCRegister'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on reproducing locally (have to set up a windows build, recently got a new laptop) but if there is any way to test #199781 against a buildbot I think it might fix this

? SuperReg
: Register(TRI.getSubReg(SuperReg, SplitParts[I]));
MCRegister SubReg = NumSubRegs == 1
? MCRegister(SuperReg)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slinder1
MSVC is complaining:

error C2440: '<function-style-cast>': cannot convert from 'llvm::Register' to 'llvm::MCRegister'

schuermans-roofline added a commit to schuermans-roofline/llvm-project that referenced this pull request May 27, 2026
This change adapts the bazel build system for the change in:
[BBAddrMap] Drive Features and Metadata bits from BBAddrMap.def (llvm#196906)pick 7ea8e6eb3ee7 Revert "[AMDGPU] Implement CFI for non-kernel functions (llvm#183153)"
commit 532940b
The commit had added a .def file, which was not found by the glob for .h in the
bazel build file. This change adds a glob for *.def to fix this.
arsenm pushed a commit that referenced this pull request May 27, 2026
This is a fix for "[AMDGPU] Implement CFI for non-kernel functions
(#183153)" f78a233 to use
"SuperReg.asMCReg()" instead of "MCRegister(SuperReg)", which leads to
"ambiguous call" when using the MSVC compiler.
slinder1 added a commit that referenced this pull request May 27, 2026
Change-Id: I285adf09ac2df239d0ab05459f7388b6970247ad
slinder1 added a commit that referenced this pull request May 27, 2026
Change-Id: I285adf09ac2df239d0ab05459f7388b6970247ad
@slinder1

Copy link
Copy Markdown
Contributor Author

🛠️ Changes since last push: none (likely a rebase)

1 similar comment
@slinder1

Copy link
Copy Markdown
Contributor Author

🛠️ Changes since last push: none (likely a rebase)

ronlieb pushed a commit to ROCm/llvm-project that referenced this pull request May 27, 2026
This is a fix for "[AMDGPU] Implement CFI for non-kernel functions
(llvm#183153)" f78a233 to use
"SuperReg.asMCReg()" instead of "MCRegister(SuperReg)", which leads to
"ambiguous call" when using the MSVC compiler.
ronlieb pushed a commit to ROCm/llvm-project that referenced this pull request May 27, 2026
Change-Id: I285adf09ac2df239d0ab05459f7388b6970247ad
@slinder1

Copy link
Copy Markdown
Contributor Author

🛠️ Changes since last push: none (likely a rebase)

1 similar comment
@slinder1

Copy link
Copy Markdown
Contributor Author

🛠️ Changes since last push: none (likely a rebase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants