From 04c3ac5b9c4c13a8efc9a36792350424e2aedfda Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Tue, 27 Nov 2018 19:55:26 -0800 Subject: Revert "AArch64: Emit a call frame instruction for the shadow call stack register." This reverts commit 085f1615ff48d906813747e3c1a6bf3166ea59c9. Bug: 120043369 Change-Id: I2c73ab4930d1c4a89c59de0f4a2e8bd5ab426734 --- lib/Target/AArch64/AArch64FrameLowering.cpp | 31 ++++++----------------------- test/CodeGen/AArch64/shadow-call-stack.ll | 1 - 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/lib/Target/AArch64/AArch64FrameLowering.cpp b/lib/Target/AArch64/AArch64FrameLowering.cpp index 422c91fa704..9c85001481d 100644 --- a/lib/Target/AArch64/AArch64FrameLowering.cpp +++ b/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -585,12 +585,10 @@ static MachineBasicBlock::iterator convertCalleeSaveRestoreToSPPrePostIncDec( const DebugLoc &DL, const TargetInstrInfo *TII, int CSStackSizeInc, bool NeedsWinCFI, bool InProlog = true) { // Ignore instructions that do not operate on SP, i.e. shadow call stack - // instructions and associated CFI instruction. + // instructions. while (MBBI->getOpcode() == AArch64::STRXpost || - MBBI->getOpcode() == AArch64::LDRXpre || - MBBI->getOpcode() == AArch64::CFI_INSTRUCTION) { - if (MBBI->getOpcode() != AArch64::CFI_INSTRUCTION) - assert(MBBI->getOperand(0).getReg() != AArch64::SP); + MBBI->getOpcode() == AArch64::LDRXpre) { + assert(MBBI->getOperand(0).getReg() != AArch64::SP); ++MBBI; } unsigned NewOpc; @@ -687,11 +685,9 @@ static void fixupCalleeSaveRestoreStackOffset(MachineInstr &MI, unsigned Opc = MI.getOpcode(); // Ignore instructions that do not operate on SP, i.e. shadow call stack - // instructions and associated CFI instruction. - if (Opc == AArch64::STRXpost || Opc == AArch64::LDRXpre || - Opc == AArch64::CFI_INSTRUCTION) { - if (Opc != AArch64::CFI_INSTRUCTION) - assert(MI.getOperand(0).getReg() != AArch64::SP); + // instructions. + if (Opc == AArch64::STRXpost || Opc == AArch64::LDRXpre) { + assert(MI.getOperand(0).getReg() != AArch64::SP); return; } @@ -1679,21 +1675,6 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters( BuildMI(MBB, MI, DL, TII.get(AArch64::SEH_Nop)) .setMIFlag(MachineInstr::FrameSetup); - // Emit a CFI instruction that causes 8 to be subtracted from the value of - // x18 when unwinding past this frame. - static const char CFIInst[] = { - dwarf::DW_CFA_val_expression, - 18, // register - 2, // length - static_cast(dwarf::DW_OP_breg18), - static_cast(-8) & 0x7f, // addend (sleb128) - }; - unsigned CFIIndex = - MF.addFrameInst(MCCFIInstruction::createEscape(nullptr, CFIInst)); - BuildMI(MBB, MI, DL, TII.get(AArch64::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex) - .setMIFlag(MachineInstr::FrameSetup); - // This instruction also makes x18 live-in to the entry block. MBB.addLiveIn(AArch64::X18); } diff --git a/test/CodeGen/AArch64/shadow-call-stack.ll b/test/CodeGen/AArch64/shadow-call-stack.ll index 7ec1d639614..dbd44fd3cd1 100644 --- a/test/CodeGen/AArch64/shadow-call-stack.ll +++ b/test/CodeGen/AArch64/shadow-call-stack.ll @@ -22,7 +22,6 @@ declare i32 @bar() define i32 @f3() shadowcallstack { ; CHECK: f3: ; CHECK: str x30, [x18], #8 - ; CHECK: .cfi_escape 0x16, 0x12, 0x02, 0x82, 0x78 ; CHECK: str x30, [sp, #-16]! %res = call i32 @bar() %res1 = add i32 %res, 1 -- cgit v1.2.3