diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp --- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -1366,11 +1366,13 @@ void PPCFrameLowering::inlineStackProbe(MachineFunction &MF, MachineBasicBlock &PrologMBB) const { - // TODO: Generate CFI instructions. bool isPPC64 = Subtarget.isPPC64(); const PPCTargetLowering &TLI = *Subtarget.getTargetLowering(); const PPCInstrInfo &TII = *Subtarget.getInstrInfo(); MachineFrameInfo &MFI = MF.getFrameInfo(); + MachineModuleInfo &MMI = MF.getMMI(); + const MCRegisterInfo *MRI = MMI.getContext().getRegisterInfo(); + const bool needsCFI = MF.needsFrameMoves() && !Subtarget.isAIXABI(); auto StackAllocMIPos = llvm::find_if(PrologMBB, [](MachineInstr &MI) { int Opc = MI.getOpcode(); return Opc == PPC::PROBED_STACKALLOC_64 || Opc == PPC::PROBED_STACKALLOC_32; @@ -1394,6 +1396,22 @@ // Initialize current frame pointer. const MCInstrDesc &CopyInst = TII.get(isPPC64 ? PPC::OR8 : PPC::OR); BuildMI(PrologMBB, {MI}, DL, CopyInst, FPReg).addReg(SPReg).addReg(SPReg); + // Subroutines to generate .cfi_* directives. + auto buildDefCFAReg = [&](MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, Register Reg) { + unsigned RegNum = MRI->getDwarfRegNum(Reg, true); + unsigned CFIIndex = MF.addFrameInst( + MCCFIInstruction::createDefCfaRegister(nullptr, RegNum)); + BuildMI(MBB, MBBI, DL, TII.get(TargetOpcode::CFI_INSTRUCTION)) + .addCFIIndex(CFIIndex); + }; + auto buildCFAOffset = [&](MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, int Offset) { + unsigned CFIIndex = MBB.getParent()->addFrameInst( + MCCFIInstruction::cfiDefCfaOffset(nullptr, Offset)); + BuildMI(MBB, MBBI, DL, TII.get(TargetOpcode::CFI_INSTRUCTION)) + .addCFIIndex(CFIIndex); + }; // Subroutine to determine if we can use the Imm as part of d-form. auto CanUseDForm = [](int64_t Imm) { return isInt<16>(Imm) && Imm % 4 == 0; }; // Subroutine to materialize the Imm into TempReg. @@ -1427,6 +1445,11 @@ .addReg(SPReg) .addReg(NegSizeReg); }; + // Use FPReg to calculate CFA. + if (needsCFI) { + buildDefCFAReg(PrologMBB, {MI}, FPReg); + buildCFAOffset(PrologMBB, {MI}, 0); + } // For case HasBP && MaxAlign > 1, we have to align the SP by performing // SP = SP - SP % MaxAlign. if (HasBP && MaxAlign > 1) { @@ -1462,6 +1485,10 @@ MaterializeImm(PrologMBB, {MI}, NegProbeSize, ScratchReg); for (int i = 0; i < NumBlocks; ++i) allocateAndProbe(PrologMBB, {MI}, NegProbeSize, ScratchReg, UseDForm); + if (needsCFI) { + // Restore using SPReg to calculate CFA. + buildDefCFAReg(PrologMBB, {MI}, SPReg); + } } else { // Since CTR is a volatile register and current shrinkwrap implementation // won't choose an MBB in a loop as the PrologMBB, it's safe to synthesize a @@ -1492,6 +1519,10 @@ PrologMBB.end()); ExitMBB->transferSuccessorsAndUpdatePHIs(&PrologMBB); PrologMBB.addSuccessor(LoopMBB); + if (needsCFI) { + // Restore using SPReg to calculate CFA. + buildDefCFAReg(*ExitMBB, ExitMBB->begin(), SPReg); + } // Update liveins. recomputeLiveIns(*LoopMBB); recomputeLiveIns(*ExitMBB); diff --git a/llvm/test/CodeGen/PowerPC/stack-clash-prologue.ll b/llvm/test/CodeGen/PowerPC/stack-clash-prologue.ll --- a/llvm/test/CodeGen/PowerPC/stack-clash-prologue.ll +++ b/llvm/test/CodeGen/PowerPC/stack-clash-prologue.ll @@ -10,7 +10,7 @@ ; RUN: -check-prefix=CHECK-32 %s ; Free probe -define i8 @f0() #0 nounwind { +define i8 @f0() #0 { ; CHECK-LE-LABEL: f0: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: li r3, 3 @@ -28,6 +28,7 @@ ; CHECK-32-LABEL: f0: ; CHECK-32: # %bb.0: # %entry ; CHECK-32-NEXT: stwu r1, -80(r1) +; CHECK-32-NEXT: .cfi_def_cfa_offset 80 ; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: lbz r3, 16(r1) @@ -41,10 +42,12 @@ ret i8 %c } -define i8 @f1() #0 "stack-probe-size"="0" nounwind { +define i8 @f1() #0 "stack-probe-size"="0" { ; CHECK-LE-LABEL: f1: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: mr r12, r1 +; CHECK-LE-NEXT: .cfi_def_cfa_register r12 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-LE-NEXT: li r0, 259 ; CHECK-LE-NEXT: mtctr r0 ; CHECK-LE-NEXT: .LBB1_1: # %entry @@ -52,6 +55,8 @@ ; CHECK-LE-NEXT: stdu r12, -16(r1) ; CHECK-LE-NEXT: bdnz .LBB1_1 ; CHECK-LE-NEXT: # %bb.2: # %entry +; CHECK-LE-NEXT: .cfi_def_cfa_register r1 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 4144 ; CHECK-LE-NEXT: li r3, 3 ; CHECK-LE-NEXT: stb r3, 48(r1) ; CHECK-LE-NEXT: lbz r3, 48(r1) @@ -61,6 +66,8 @@ ; CHECK-BE-LABEL: f1: ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: mr r12, r1 +; CHECK-BE-NEXT: .cfi_def_cfa_register r12 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-BE-NEXT: li r0, 260 ; CHECK-BE-NEXT: mtctr r0 ; CHECK-BE-NEXT: .LBB1_1: # %entry @@ -68,6 +75,8 @@ ; CHECK-BE-NEXT: stdu r12, -16(r1) ; CHECK-BE-NEXT: bdnz .LBB1_1 ; CHECK-BE-NEXT: # %bb.2: # %entry +; CHECK-BE-NEXT: .cfi_def_cfa_register r1 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 4160 ; CHECK-BE-NEXT: li r3, 3 ; CHECK-BE-NEXT: stb r3, 64(r1) ; CHECK-BE-NEXT: lbz r3, 64(r1) @@ -77,6 +86,8 @@ ; CHECK-32-LABEL: f1: ; CHECK-32: # %bb.0: # %entry ; CHECK-32-NEXT: mr r12, r1 +; CHECK-32-NEXT: .cfi_def_cfa_register r12 +; CHECK-32-NEXT: .cfi_def_cfa_offset 0 ; CHECK-32-NEXT: li r0, 257 ; CHECK-32-NEXT: mtctr r0 ; CHECK-32-NEXT: .LBB1_1: # %entry @@ -84,10 +95,12 @@ ; CHECK-32-NEXT: stwu r12, -16(r1) ; CHECK-32-NEXT: bdnz .LBB1_1 ; CHECK-32-NEXT: # %bb.2: # %entry -; CHECK-32-NEXT: li r3, 3 +; CHECK-32-NEXT: .cfi_def_cfa_register r1 ; CHECK-32-NEXT: sub r0, r1, r12 -; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: sub r0, r1, r0 +; CHECK-32-NEXT: .cfi_def_cfa_offset 4112 +; CHECK-32-NEXT: li r3, 3 +; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: lbz r3, 16(r1) ; CHECK-32-NEXT: addi r1, r1, 4112 ; CHECK-32-NEXT: blr @@ -99,10 +112,12 @@ ret i8 %c } -define i8 @f2() #0 nounwind { +define i8 @f2() #0 { ; CHECK-LE-LABEL: f2: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: mr r12, r1 +; CHECK-LE-NEXT: .cfi_def_cfa_register r12 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-LE-NEXT: stdu r12, -48(r1) ; CHECK-LE-NEXT: li r0, 16 ; CHECK-LE-NEXT: mtctr r0 @@ -111,6 +126,8 @@ ; CHECK-LE-NEXT: stdu r12, -4096(r1) ; CHECK-LE-NEXT: bdnz .LBB2_1 ; CHECK-LE-NEXT: # %bb.2: # %entry +; CHECK-LE-NEXT: .cfi_def_cfa_register r1 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 65584 ; CHECK-LE-NEXT: li r3, 3 ; CHECK-LE-NEXT: stb r3, 48(r1) ; CHECK-LE-NEXT: lbz r3, 48(r1) @@ -120,6 +137,8 @@ ; CHECK-BE-LABEL: f2: ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: mr r12, r1 +; CHECK-BE-NEXT: .cfi_def_cfa_register r12 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-BE-NEXT: stdu r12, -64(r1) ; CHECK-BE-NEXT: li r0, 16 ; CHECK-BE-NEXT: mtctr r0 @@ -128,6 +147,8 @@ ; CHECK-BE-NEXT: stdu r12, -4096(r1) ; CHECK-BE-NEXT: bdnz .LBB2_1 ; CHECK-BE-NEXT: # %bb.2: # %entry +; CHECK-BE-NEXT: .cfi_def_cfa_register r1 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 65600 ; CHECK-BE-NEXT: li r3, 3 ; CHECK-BE-NEXT: stb r3, 64(r1) ; CHECK-BE-NEXT: lbz r3, 64(r1) @@ -137,6 +158,8 @@ ; CHECK-32-LABEL: f2: ; CHECK-32: # %bb.0: # %entry ; CHECK-32-NEXT: mr r12, r1 +; CHECK-32-NEXT: .cfi_def_cfa_register r12 +; CHECK-32-NEXT: .cfi_def_cfa_offset 0 ; CHECK-32-NEXT: stwu r12, -16(r1) ; CHECK-32-NEXT: li r0, 16 ; CHECK-32-NEXT: mtctr r0 @@ -145,9 +168,11 @@ ; CHECK-32-NEXT: stwu r12, -4096(r1) ; CHECK-32-NEXT: bdnz .LBB2_1 ; CHECK-32-NEXT: # %bb.2: # %entry +; CHECK-32-NEXT: .cfi_def_cfa_register r1 ; CHECK-32-NEXT: sub r0, r1, r12 -; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: sub r0, r1, r0 +; CHECK-32-NEXT: .cfi_def_cfa_offset 65552 +; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: mr r0, r31 ; CHECK-32-NEXT: lbz r3, 16(r1) @@ -163,13 +188,17 @@ ret i8 %c } -define i8 @f3() #0 "stack-probe-size"="32768" nounwind { +define i8 @f3() #0 "stack-probe-size"="32768" { ; CHECK-LE-LABEL: f3: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: mr r12, r1 +; CHECK-LE-NEXT: .cfi_def_cfa_register r12 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-LE-NEXT: stdu r12, -48(r1) ; CHECK-LE-NEXT: stdu r12, -32768(r1) ; CHECK-LE-NEXT: stdu r12, -32768(r1) +; CHECK-LE-NEXT: .cfi_def_cfa_register r1 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 65584 ; CHECK-LE-NEXT: li r3, 3 ; CHECK-LE-NEXT: stb r3, 48(r1) ; CHECK-LE-NEXT: lbz r3, 48(r1) @@ -179,9 +208,13 @@ ; CHECK-BE-LABEL: f3: ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: mr r12, r1 +; CHECK-BE-NEXT: .cfi_def_cfa_register r12 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-BE-NEXT: stdu r12, -64(r1) ; CHECK-BE-NEXT: stdu r12, -32768(r1) ; CHECK-BE-NEXT: stdu r12, -32768(r1) +; CHECK-BE-NEXT: .cfi_def_cfa_register r1 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 65600 ; CHECK-BE-NEXT: li r3, 3 ; CHECK-BE-NEXT: stb r3, 64(r1) ; CHECK-BE-NEXT: lbz r3, 64(r1) @@ -191,12 +224,16 @@ ; CHECK-32-LABEL: f3: ; CHECK-32: # %bb.0: # %entry ; CHECK-32-NEXT: mr r12, r1 +; CHECK-32-NEXT: .cfi_def_cfa_register r12 +; CHECK-32-NEXT: .cfi_def_cfa_offset 0 ; CHECK-32-NEXT: stwu r12, -16(r1) ; CHECK-32-NEXT: stwu r12, -32768(r1) ; CHECK-32-NEXT: stwu r12, -32768(r1) +; CHECK-32-NEXT: .cfi_def_cfa_register r1 ; CHECK-32-NEXT: sub r0, r1, r12 -; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: sub r0, r1, r0 +; CHECK-32-NEXT: .cfi_def_cfa_offset 65552 +; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: mr r0, r31 ; CHECK-32-NEXT: lbz r3, 16(r1) @@ -213,12 +250,13 @@ } ; Same as f2, but without protection. -define i8 @f4() nounwind { +define i8 @f4() { ; CHECK-LE-LABEL: f4: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: lis r0, -2 ; CHECK-LE-NEXT: ori r0, r0, 65488 ; CHECK-LE-NEXT: stdux r1, r1, r0 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 65584 ; CHECK-LE-NEXT: li r3, 3 ; CHECK-LE-NEXT: stb r3, 48(r1) ; CHECK-LE-NEXT: lbz r3, 48(r1) @@ -230,6 +268,7 @@ ; CHECK-BE-NEXT: lis r0, -2 ; CHECK-BE-NEXT: ori r0, r0, 65472 ; CHECK-BE-NEXT: stdux r1, r1, r0 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 65600 ; CHECK-BE-NEXT: li r3, 3 ; CHECK-BE-NEXT: stb r3, 64(r1) ; CHECK-BE-NEXT: lbz r3, 64(r1) @@ -241,8 +280,9 @@ ; CHECK-32-NEXT: lis r0, -2 ; CHECK-32-NEXT: ori r0, r0, 65520 ; CHECK-32-NEXT: stwux r1, r1, r0 -; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: sub r0, r1, r0 +; CHECK-32-NEXT: .cfi_def_cfa_offset 65552 +; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: mr r0, r31 ; CHECK-32-NEXT: lbz r3, 16(r1) @@ -258,10 +298,12 @@ ret i8 %c } -define i8 @f5() #0 "stack-probe-size"="65536" nounwind { +define i8 @f5() #0 "stack-probe-size"="65536" { ; CHECK-LE-LABEL: f5: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: mr r12, r1 +; CHECK-LE-NEXT: .cfi_def_cfa_register r12 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-LE-NEXT: stdu r12, -48(r1) ; CHECK-LE-NEXT: li r0, 16 ; CHECK-LE-NEXT: mtctr r0 @@ -272,6 +314,8 @@ ; CHECK-LE-NEXT: stdux r12, r1, r0 ; CHECK-LE-NEXT: bdnz .LBB5_1 ; CHECK-LE-NEXT: # %bb.2: # %entry +; CHECK-LE-NEXT: .cfi_def_cfa_register r1 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 1048624 ; CHECK-LE-NEXT: li r3, 3 ; CHECK-LE-NEXT: stb r3, 48(r1) ; CHECK-LE-NEXT: lbz r3, 48(r1) @@ -281,6 +325,8 @@ ; CHECK-BE-LABEL: f5: ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: mr r12, r1 +; CHECK-BE-NEXT: .cfi_def_cfa_register r12 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-BE-NEXT: stdu r12, -64(r1) ; CHECK-BE-NEXT: li r0, 16 ; CHECK-BE-NEXT: mtctr r0 @@ -291,6 +337,8 @@ ; CHECK-BE-NEXT: stdux r12, r1, r0 ; CHECK-BE-NEXT: bdnz .LBB5_1 ; CHECK-BE-NEXT: # %bb.2: # %entry +; CHECK-BE-NEXT: .cfi_def_cfa_register r1 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 1048640 ; CHECK-BE-NEXT: li r3, 3 ; CHECK-BE-NEXT: stb r3, 64(r1) ; CHECK-BE-NEXT: lbz r3, 64(r1) @@ -300,6 +348,8 @@ ; CHECK-32-LABEL: f5: ; CHECK-32: # %bb.0: # %entry ; CHECK-32-NEXT: mr r12, r1 +; CHECK-32-NEXT: .cfi_def_cfa_register r12 +; CHECK-32-NEXT: .cfi_def_cfa_offset 0 ; CHECK-32-NEXT: stwu r12, -16(r1) ; CHECK-32-NEXT: li r0, 16 ; CHECK-32-NEXT: mtctr r0 @@ -310,9 +360,11 @@ ; CHECK-32-NEXT: stwux r12, r1, r0 ; CHECK-32-NEXT: bdnz .LBB5_1 ; CHECK-32-NEXT: # %bb.2: # %entry +; CHECK-32-NEXT: .cfi_def_cfa_register r1 ; CHECK-32-NEXT: sub r0, r1, r12 -; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: sub r0, r1, r0 +; CHECK-32-NEXT: .cfi_def_cfa_offset 1048592 +; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: mr r0, r31 ; CHECK-32-NEXT: lbz r3, 16(r1) @@ -328,10 +380,12 @@ ret i8 %c } -define i8 @f6() #0 nounwind { +define i8 @f6() #0 { ; CHECK-LE-LABEL: f6: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: mr r12, r1 +; CHECK-LE-NEXT: .cfi_def_cfa_register r12 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-LE-NEXT: stdu r12, -48(r1) ; CHECK-LE-NEXT: lis r0, 4 ; CHECK-LE-NEXT: nop @@ -341,6 +395,8 @@ ; CHECK-LE-NEXT: stdu r12, -4096(r1) ; CHECK-LE-NEXT: bdnz .LBB6_1 ; CHECK-LE-NEXT: # %bb.2: # %entry +; CHECK-LE-NEXT: .cfi_def_cfa_register r1 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 1073741872 ; CHECK-LE-NEXT: li r3, 3 ; CHECK-LE-NEXT: stb r3, 48(r1) ; CHECK-LE-NEXT: lbz r3, 48(r1) @@ -350,6 +406,8 @@ ; CHECK-BE-LABEL: f6: ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: mr r12, r1 +; CHECK-BE-NEXT: .cfi_def_cfa_register r12 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 0 ; CHECK-BE-NEXT: stdu r12, -64(r1) ; CHECK-BE-NEXT: lis r0, 4 ; CHECK-BE-NEXT: nop @@ -359,6 +417,8 @@ ; CHECK-BE-NEXT: stdu r12, -4096(r1) ; CHECK-BE-NEXT: bdnz .LBB6_1 ; CHECK-BE-NEXT: # %bb.2: # %entry +; CHECK-BE-NEXT: .cfi_def_cfa_register r1 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 1073741888 ; CHECK-BE-NEXT: li r3, 3 ; CHECK-BE-NEXT: stb r3, 64(r1) ; CHECK-BE-NEXT: lbz r3, 64(r1) @@ -368,6 +428,8 @@ ; CHECK-32-LABEL: f6: ; CHECK-32: # %bb.0: # %entry ; CHECK-32-NEXT: mr r12, r1 +; CHECK-32-NEXT: .cfi_def_cfa_register r12 +; CHECK-32-NEXT: .cfi_def_cfa_offset 0 ; CHECK-32-NEXT: stwu r12, -16(r1) ; CHECK-32-NEXT: lis r0, 4 ; CHECK-32-NEXT: nop @@ -377,9 +439,11 @@ ; CHECK-32-NEXT: stwu r12, -4096(r1) ; CHECK-32-NEXT: bdnz .LBB6_1 ; CHECK-32-NEXT: # %bb.2: # %entry +; CHECK-32-NEXT: .cfi_def_cfa_register r1 ; CHECK-32-NEXT: sub r0, r1, r12 -; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: sub r0, r1, r0 +; CHECK-32-NEXT: .cfi_def_cfa_offset 1073741840 +; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: stb r3, 16(r1) ; CHECK-32-NEXT: mr r0, r31 ; CHECK-32-NEXT: lbz r3, 16(r1) @@ -395,11 +459,13 @@ ret i8 %c } -define i8 @f7() #0 "stack-probe-size"="65536" nounwind { +define i8 @f7() #0 "stack-probe-size"="65536" { ; CHECK-LE-LABEL: f7: ; CHECK-LE: # %bb.0: # %entry -; CHECK-LE-NEXT: lis r0, -1 ; CHECK-LE-NEXT: mr r12, r1 +; CHECK-LE-NEXT: .cfi_def_cfa_register r12 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 0 +; CHECK-LE-NEXT: lis r0, -1 ; CHECK-LE-NEXT: ori r0, r0, 13776 ; CHECK-LE-NEXT: stdux r12, r1, r0 ; CHECK-LE-NEXT: li r0, 15258 @@ -411,6 +477,8 @@ ; CHECK-LE-NEXT: stdux r12, r1, r0 ; CHECK-LE-NEXT: bdnz .LBB7_1 ; CHECK-LE-NEXT: # %bb.2: # %entry +; CHECK-LE-NEXT: .cfi_def_cfa_register r1 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 1000000048 ; CHECK-LE-NEXT: li r3, 3 ; CHECK-LE-NEXT: stb r3, 41(r1) ; CHECK-LE-NEXT: lbz r3, 41(r1) @@ -419,8 +487,10 @@ ; ; CHECK-BE-LABEL: f7: ; CHECK-BE: # %bb.0: # %entry -; CHECK-BE-NEXT: lis r0, -1 ; CHECK-BE-NEXT: mr r12, r1 +; CHECK-BE-NEXT: .cfi_def_cfa_register r12 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 0 +; CHECK-BE-NEXT: lis r0, -1 ; CHECK-BE-NEXT: ori r0, r0, 13760 ; CHECK-BE-NEXT: stdux r12, r1, r0 ; CHECK-BE-NEXT: li r0, 15258 @@ -432,6 +502,8 @@ ; CHECK-BE-NEXT: stdux r12, r1, r0 ; CHECK-BE-NEXT: bdnz .LBB7_1 ; CHECK-BE-NEXT: # %bb.2: # %entry +; CHECK-BE-NEXT: .cfi_def_cfa_register r1 +; CHECK-BE-NEXT: .cfi_def_cfa_offset 1000000064 ; CHECK-BE-NEXT: li r3, 3 ; CHECK-BE-NEXT: stb r3, 57(r1) ; CHECK-BE-NEXT: lbz r3, 57(r1) @@ -440,8 +512,10 @@ ; ; CHECK-32-LABEL: f7: ; CHECK-32: # %bb.0: # %entry -; CHECK-32-NEXT: lis r0, -1 ; CHECK-32-NEXT: mr r12, r1 +; CHECK-32-NEXT: .cfi_def_cfa_register r12 +; CHECK-32-NEXT: .cfi_def_cfa_offset 0 +; CHECK-32-NEXT: lis r0, -1 ; CHECK-32-NEXT: ori r0, r0, 13808 ; CHECK-32-NEXT: stwux r12, r1, r0 ; CHECK-32-NEXT: li r0, 15258 @@ -453,9 +527,11 @@ ; CHECK-32-NEXT: stwux r12, r1, r0 ; CHECK-32-NEXT: bdnz .LBB7_1 ; CHECK-32-NEXT: # %bb.2: # %entry +; CHECK-32-NEXT: .cfi_def_cfa_register r1 ; CHECK-32-NEXT: sub r0, r1, r12 -; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: sub r0, r1, r0 +; CHECK-32-NEXT: .cfi_def_cfa_offset 1000000016 +; CHECK-32-NEXT: li r3, 3 ; CHECK-32-NEXT: stb r3, 9(r1) ; CHECK-32-NEXT: mr r0, r31 ; CHECK-32-NEXT: lbz r3, 9(r1)