Skip to content

Commit e74c167

Browse files
kernightstellar
authored andcommitted
[PowerPC] provide CFI for ELF32 to unwind cr2, cr3, cr4 (#83098)
Delete the code that skips the CFI for the condition register on ELF32. The code checked !MustSaveCR, which happened only when Subtarget.is32BitELFABI(), where spillCalleeSavedRegisters is spilling cr in a different way. The spill was missing CFI. After deleting this code, a spill of cr2 to cr4 gets CFI in the same way as a spill of r14 to r31. Fixes #83094 (cherry picked from commit 6b70c5d)
1 parent 1c7c16e commit e74c167

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

llvm/lib/Target/PowerPC/PPCFrameLowering.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -1191,12 +1191,6 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
11911191
if ((Reg == PPC::X2 || Reg == PPC::R2) && MustSaveTOC)
11921192
continue;
11931193

1194-
// For SVR4, don't emit a move for the CR spill slot if we haven't
1195-
// spilled CRs.
1196-
if (isSVR4ABI && (PPC::CR2 <= Reg && Reg <= PPC::CR4)
1197-
&& !MustSaveCR)
1198-
continue;
1199-
12001194
// For 64-bit SVR4 when we have spilled CRs, the spill location
12011195
// is SP+8, not a frame-relative slot.
12021196
if (isSVR4ABI && isPPC64 && (PPC::CR2 <= Reg && Reg <= PPC::CR4)) {

llvm/test/CodeGen/PowerPC/crsave.ll

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ define i32 @test_cr2() nounwind uwtable {
1717
; PPC32-NEXT: .cfi_offset lr, 4
1818
; PPC32-NEXT: mr 31, 1
1919
; PPC32-NEXT: .cfi_def_cfa_register r31
20+
; PPC32-NEXT: .cfi_offset cr2, -8
2021
; PPC32-NEXT: mfcr 12
2122
; PPC32-NEXT: stw 12, 24(31)
2223
; PPC32-NEXT: li 3, 1
@@ -227,6 +228,7 @@ define void @cloberOneNvCrField() {
227228
; PPC32-NEXT: .cfi_offset r31, -4
228229
; PPC32-NEXT: mr 31, 1
229230
; PPC32-NEXT: .cfi_def_cfa_register r31
231+
; PPC32-NEXT: .cfi_offset cr2, -8
230232
; PPC32-NEXT: mfcr 12
231233
; PPC32-NEXT: stw 12, 24(31)
232234
; PPC32-NEXT: #APP
@@ -274,6 +276,9 @@ define void @cloberAllNvCrField() {
274276
; PPC32-NEXT: .cfi_offset r31, -4
275277
; PPC32-NEXT: mr 31, 1
276278
; PPC32-NEXT: .cfi_def_cfa_register r31
279+
; PPC32-NEXT: .cfi_offset cr2, -8
280+
; PPC32-NEXT: .cfi_offset cr3, -8
281+
; PPC32-NEXT: .cfi_offset cr4, -8
277282
; PPC32-NEXT: mfcr 12
278283
; PPC32-NEXT: stw 12, 24(31)
279284
; PPC32-NEXT: #APP

0 commit comments

Comments
 (0)