diff options
author | Daniel Jasper <djasper@google.com> | 2017-06-29 13:58:24 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2017-06-29 13:58:24 +0000 |
commit | 559aa75382e941a1c0c2fc5724d5274c20f2adf8 (patch) | |
tree | c8f215d8add480f68484fcc2ef8043b94f967598 /llvm/lib | |
parent | 8a44b7be76f35f26d56327952bd133a48c07f301 (diff) | |
download | bcm5719-llvm-559aa75382e941a1c0c2fc5724d5274c20f2adf8.tar.gz bcm5719-llvm-559aa75382e941a1c0c2fc5724d5274c20f2adf8.zip |
Revert "r306529 - [X86] Correct dwarf unwind information in function epilogue"
I am 99% sure that this breaks the PPC ASAN build bot:
http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/3112/steps/64-bit%20check-asan/logs/stdio
If it doesn't go back to green, we can recommit (and fix the original
commit message at the same time :) ).
llvm-svn: 306676
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 62 | ||||
-rw-r--r-- | llvm/lib/CodeGen/CFIInfoVerifier.cpp | 123 | ||||
-rw-r--r-- | llvm/lib/CodeGen/CFIInstrInserter.cpp | 124 | ||||
-rw-r--r-- | llvm/lib/CodeGen/CMakeLists.txt | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/CodeGen.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 227 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 38 | ||||
-rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TailDuplicator.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86CallFrameOptimization.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86FrameLowering.cpp | 119 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86FrameLowering.h | 2 |
13 files changed, 22 insertions, 716 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index ed7e22d3eef..53095497629 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -304,9 +304,9 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1, while (I1 != MBB1->begin() && I2 != MBB2->begin()) { --I1; --I2; // Skip debugging pseudos; necessary to avoid changing the code. - while (I1->isDirective()) { + while (I1->isDebugValue()) { if (I1==MBB1->begin()) { - while (I2->isDirective()) { + while (I2->isDebugValue()) { if (I2==MBB2->begin()) // I1==DBG at begin; I2==DBG at begin return TailLen; @@ -319,7 +319,7 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1, --I1; } // I1==first (untested) non-DBG preceding known match - while (I2->isDirective()) { + while (I2->isDebugValue()) { if (I2==MBB2->begin()) { ++I1; // I1==non-DBG, or first of DBGs not at begin; I2==DBG at begin @@ -362,35 +362,6 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1, } ++I1; } - - // Ensure that I1 and I2 do not point to a CFI_INSTRUCTION. This can happen if - // I1 and I2 are non-identical when compared and then one or both of them ends - // up pointing to a CFI instruction after being incremented. For example: - /* - BB1: - ... - INSTRUCTION_A - ADD32ri8 <- last common instruction - ... - BB2: - ... - INSTRUCTION_B - CFI_INSTRUCTION - ADD32ri8 <- last common instruction - ... - */ - // When INSTRUCTION_A and INSTRUCTION_B are compared as not equal, after - // incrementing the iterators, I1 will point to ADD, however I2 will point to - // the CFI instruction. Later on, this leads to BB2 being 'hacked off' at the - // wrong place (in ReplaceTailWithBranchTo()) which results in losing this CFI - // instruction. - while (I1 != MBB1->end() && I1->isCFIInstruction()) { - ++I1; - } - - while (I2 != MBB2->end() && I2->isCFIInstruction()) { - ++I2; - } return TailLen; } @@ -446,14 +417,6 @@ MachineBasicBlock *BranchFolder::SplitMBBAt(MachineBasicBlock &CurMBB, FuncletMembership[NewMBB] = n; } - // Recalculate CFI info for CurMBB. Use existing incoming cfa offset and - // register. - CurMBB.recalculateCFIInfo(true); - // Recalculate CFI info for NewMBB. Use CurMBB's outgoing cfa offset and - // register as NewMBB's incoming. - NewMBB->recalculateCFIInfo(false, CurMBB.getOutgoingCFAOffset(), - CurMBB.getOutgoingCFARegister()); - return NewMBB; } @@ -463,7 +426,7 @@ static unsigned EstimateRuntime(MachineBasicBlock::iterator I, MachineBasicBlock::iterator E) { unsigned Time = 0; for (; I != E; ++I) { - if (I->isDirective()) + if (I->isDebugValue()) continue; if (I->isCall()) Time += 10; @@ -817,7 +780,7 @@ void BranchFolder::MergeCommonTailDebugLocs(unsigned commonTailIndex) { } for (auto &MI : *MBB) { - if (MI.isDirective()) + if (MI.isDebugValue()) continue; DebugLoc DL = MI.getDebugLoc(); for (unsigned int i = 0 ; i < NextCommonInsts.size() ; i++) { @@ -827,7 +790,7 @@ void BranchFolder::MergeCommonTailDebugLocs(unsigned commonTailIndex) { auto &Pos = NextCommonInsts[i]; assert(Pos != SameTails[i].getBlock()->end() && "Reached BB end within common tail"); - while (Pos->isDirective()) { + while (Pos->isDebugValue()) { ++Pos; assert(Pos != SameTails[i].getBlock()->end() && "Reached BB end within common tail"); @@ -860,12 +823,12 @@ mergeOperations(MachineBasicBlock::iterator MBBIStartPos, assert(MBBI != MBBIE && "Reached BB end within common tail length!"); (void)MBBIE; - if (MBBI->isDirective()) { + if (MBBI->isDebugValue()) { ++MBBI; continue; } - while ((MBBICommon != MBBIECommon) && MBBICommon->isDirective()) + while ((MBBICommon != MBBIECommon) && MBBICommon->isDebugValue()) ++MBBICommon; assert(MBBICommon != MBBIECommon && @@ -1008,11 +971,6 @@ bool BranchFolder::TryTailMergeBlocks(MachineBasicBlock *SuccBB, mergeOperations(SameTails[i].getTailStartPos(), *MBB); // Hack the end off BB i, making it jump to BB commonTailIndex instead. ReplaceTailWithBranchTo(SameTails[i].getTailStartPos(), MBB); - - // Recalculate CFI info for BB. Use existing incoming cfa offset and - // register. - SameTails[i].getBlock()->recalculateCFIInfo(true); - // BB i is no longer a predecessor of SuccBB; remove it from the worklist. MergePotentials.erase(SameTails[i].getMPIter()); } @@ -1423,10 +1381,6 @@ ReoptimizeBlock: assert(PrevBB.succ_empty()); PrevBB.transferSuccessors(MBB); MadeChange = true; - - // Update CFI info for PrevBB. - PrevBB.mergeCFIInfo(MBB); - return MadeChange; } diff --git a/llvm/lib/CodeGen/CFIInfoVerifier.cpp b/llvm/lib/CodeGen/CFIInfoVerifier.cpp deleted file mode 100644 index ff5a953c242..00000000000 --- a/llvm/lib/CodeGen/CFIInfoVerifier.cpp +++ /dev/null @@ -1,123 +0,0 @@ -//===----------- CFIInfoVerifier.cpp - CFI Information Verifier -----------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass verifies incoming and outgoing CFI information of basic blocks. CFI -// information is information about offset and register set by CFI directives, -// valid at the start and end of a basic block. This pass checks that outgoing -// information of predecessors matches incoming information of their successors. -//===----------------------------------------------------------------------===// - -#include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetMachine.h" -using namespace llvm; - -namespace { -class CFIInfoVerifier : public MachineFunctionPass { - public: - static char ID; - - CFIInfoVerifier() : MachineFunctionPass(ID) { - initializeCFIInfoVerifierPass(*PassRegistry::getPassRegistry()); - } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.setPreservesAll(); - MachineFunctionPass::getAnalysisUsage(AU); - } - - bool runOnMachineFunction(MachineFunction &MF) override { - bool NeedsDwarfCFI = (MF.getMMI().hasDebugInfo() || - MF.getFunction()->needsUnwindTableEntry()) && - (!MF.getTarget().getTargetTriple().isOSDarwin() && - !MF.getTarget().getTargetTriple().isOSWindows()); - if (!NeedsDwarfCFI) return false; - verify(MF); - return false; - } - - private: - // Go through each MBB in a function and check that outgoing offset and - // register of its predecessors match incoming offset and register of that - // MBB, as well as that incoming offset and register of its successors match - // outgoing offset and register of the MBB. - void verify(MachineFunction &MF); - void report(const char *msg, MachineBasicBlock &MBB); -}; -} - -char CFIInfoVerifier::ID = 0; -INITIALIZE_PASS(CFIInfoVerifier, "cfiinfoverifier", - "Verify that corresponding in/out CFI info matches", false, - false) -FunctionPass *llvm::createCFIInfoVerifier() { return new CFIInfoVerifier(); } - -void CFIInfoVerifier::verify(MachineFunction &MF) { - for (auto &CurrMBB : MF) { - for (auto Pred : CurrMBB.predecessors()) { - // Check that outgoing offset values of predecessors match the incoming - // offset value of CurrMBB - if (Pred->getOutgoingCFAOffset() != CurrMBB.getIncomingCFAOffset()) { - report("The outgoing offset of a predecessor is inconsistent.", - CurrMBB); - errs() << "Predecessor BB#" << Pred->getNumber() - << " has outgoing offset (" << Pred->getOutgoingCFAOffset() - << "), while BB#" << CurrMBB.getNumber() - << " has incoming offset (" << CurrMBB.getIncomingCFAOffset() - << ").\n"; - } - // Check that outgoing register values of predecessors match the incoming - // register value of CurrMBB - if (Pred->getOutgoingCFARegister() != CurrMBB.getIncomingCFARegister()) { - report("The outgoing register of a predecessor is inconsistent.", - CurrMBB); - errs() << "Predecessor BB#" << Pred->getNumber() - << " has outgoing register (" << Pred->getOutgoingCFARegister() - << "), while BB#" << CurrMBB.getNumber() - << " has incoming register (" << CurrMBB.getIncomingCFARegister() - << ").\n"; - } - } - - for (auto Succ : CurrMBB.successors()) { - // Check that incoming offset values of successors match the outgoing - // offset value of CurrMBB - if (Succ->getIncomingCFAOffset() != CurrMBB.getOutgoingCFAOffset()) { - report("The incoming offset of a successor is inconsistent.", CurrMBB); - errs() << "Successor BB#" << Succ->getNumber() - << " has incoming offset (" << Succ->getIncomingCFAOffset() - << "), while BB#" << CurrMBB.getNumber() - << " has outgoing offset (" << CurrMBB.getOutgoingCFAOffset() - << ").\n"; - } - // Check that incoming register values of successors match the outgoing - // register value of CurrMBB - if (Succ->getIncomingCFARegister() != CurrMBB.getOutgoingCFARegister()) { - report("The incoming register of a successor is inconsistent.", - CurrMBB); - errs() << "Successor BB#" << Succ->getNumber() - << " has incoming register (" << Succ->getIncomingCFARegister() - << "), while BB#" << CurrMBB.getNumber() - << " has outgoing register (" << CurrMBB.getOutgoingCFARegister() - << ").\n"; - } - } - } -} - -void CFIInfoVerifier::report(const char *msg, MachineBasicBlock &MBB) { - assert(&MBB); - errs() << '\n'; - errs() << "*** " << msg << " ***\n" - << "- function: " << MBB.getParent()->getName() << "\n"; - errs() << "- basic block: BB#" << MBB.getNumber() << ' ' << MBB.getName() - << " (" << (const void *)&MBB << ')'; - errs() << '\n'; -} diff --git a/llvm/lib/CodeGen/CFIInstrInserter.cpp b/llvm/lib/CodeGen/CFIInstrInserter.cpp deleted file mode 100644 index b83c957d7c4..00000000000 --- a/llvm/lib/CodeGen/CFIInstrInserter.cpp +++ /dev/null @@ -1,124 +0,0 @@ -//===------ CFIInstrInserter.cpp - Insert additional CFI instructions -----===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Insert CFI instructions at the beginnings of basic blocks if needed. CFI -// instructions are inserted if basic blocks have incorrect offset or register -// set by prevoius blocks. -// -//===----------------------------------------------------------------------===// -#include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/CodeGen/MachineInstrBuilder.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetInstrInfo.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetSubtargetInfo.h" -using namespace llvm; - -namespace { -class CFIInstrInserter : public MachineFunctionPass { - public: - CFIInstrInserter() : MachineFunctionPass(ID) { - initializeCFIInstrInserterPass(*PassRegistry::getPassRegistry()); - } - bool runOnMachineFunction(MachineFunction &MF) override; - static char ID; - - private: - StringRef getPassName() const override { return "CFI Instruction Inserter"; } - - // Check if incoming CFI information of a basic block matches outgoing CFI - // information of the previous block. If it doesn't, insert CFI instruction at - // the beginning of the block that corrects the CFA calculation rule for that - // block. - void CorrectCFA(MachineFunction &MF); - - // Return the cfa offset value that should be set at the beginning of MBB if - // needed. The negated value is needed when creating CFI instructions that set - // absolute offset. - int getCorrectCFAOffset(MachineBasicBlock &MBB) { - return -MBB.getIncomingCFAOffset(); - } - - // Were any CFI instructions inserted - bool InsertedCFIInstr = false; -}; -} - -char CFIInstrInserter::ID = 0; -INITIALIZE_PASS(CFIInstrInserter, "cfiinstrinserter", - "Check CFI info and insert CFI instructions if needed", false, - false) - -FunctionPass *llvm::createCFIInstrInserter() { return new CFIInstrInserter(); } - -bool CFIInstrInserter::runOnMachineFunction(MachineFunction &MF) { - bool NeedsDwarfCFI = (MF.getMMI().hasDebugInfo() || - MF.getFunction()->needsUnwindTableEntry()) && - (!MF.getTarget().getTargetTriple().isOSDarwin() && - !MF.getTarget().getTargetTriple().isOSWindows()); - - if (!NeedsDwarfCFI) return false; - - // Insert appropriate CFI instructions for each MBB if CFA calculation rule - // needs to be corrected for that MBB. - CorrectCFA(MF); - - return InsertedCFIInstr; -} - -void CFIInstrInserter::CorrectCFA(MachineFunction &MF) { - - MachineBasicBlock &FirstMBB = MF.front(); - MachineBasicBlock *PrevMBB = &FirstMBB; - const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo(); - InsertedCFIInstr = false; - - for (auto &MBB : MF) { - // Skip the first MBB in a function - if (MBB.getNumber() == FirstMBB.getNumber()) continue; - - auto MBBI = MBB.begin(); - DebugLoc DL = MBB.findDebugLoc(MBBI); - - if (PrevMBB->getOutgoingCFAOffset() != MBB.getIncomingCFAOffset()) { - // If both outgoing offset and register of a previous block don't match - // incoming offset and register of this block, add a def_cfa instruction - // with the correct offset and register for this block. - if (PrevMBB->getOutgoingCFARegister() != MBB.getIncomingCFARegister()) { - unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa( - nullptr, MBB.getIncomingCFARegister(), getCorrectCFAOffset(MBB))); - BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex); - // If outgoing offset of a previous block doesn't match incoming offset - // of this block, add a def_cfa_offset instruction with the correct - // offset for this block. - } else { - unsigned CFIIndex = - MF.addFrameInst(MCCFIInstruction::createDefCfaOffset( - nullptr, getCorrectCFAOffset(MBB))); - BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex); - } - InsertedCFIInstr = true; - // If outgoing register of a previous block doesn't match incoming - // register of this block, add a def_cfa_register instruction with the - // correct register for this block. - } else if (PrevMBB->getOutgoingCFARegister() != - MBB.getIncomingCFARegister()) { - unsigned CFIIndex = - MF.addFrameInst(MCCFIInstruction::createDefCfaRegister( - nullptr, MBB.getIncomingCFARegister())); - BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex); - InsertedCFIInstr = true; - } - PrevMBB = &MBB; - } -} diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt index be6dcbfee0a..7f3c6da9126 100644 --- a/llvm/lib/CodeGen/CMakeLists.txt +++ b/llvm/lib/CodeGen/CMakeLists.txt @@ -10,8 +10,6 @@ add_llvm_library(LLVMCodeGen BuiltinGCs.cpp CalcSpillWeights.cpp CallingConvLower.cpp - CFIInfoVerifier.cpp - CFIInstrInserter.cpp CodeGen.cpp CodeGenPrepare.cpp CountingFunctionInserter.cpp diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp index 453e17e575d..faa5f139cf7 100644 --- a/llvm/lib/CodeGen/CodeGen.cpp +++ b/llvm/lib/CodeGen/CodeGen.cpp @@ -24,8 +24,6 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeBranchCoalescingPass(Registry); initializeBranchFolderPassPass(Registry); initializeBranchRelaxationPass(Registry); - initializeCFIInfoVerifierPass(Registry); - initializeCFIInstrInserterPass(Registry); initializeCodeGenPreparePass(Registry); initializeCountingFunctionInserterPass(Registry); initializeDeadMachineInstructionElimPass(Registry); diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index c9976d7f2ff..81597afe6b0 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -35,8 +35,6 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" #include <algorithm> -#include <queue> -#include <set> using namespace llvm; #define DEBUG_TYPE "codegen" @@ -1345,228 +1343,3 @@ MachineBasicBlock::livein_iterator MachineBasicBlock::livein_begin() const { "Liveness information is accurate"); return LiveIns.begin(); } - -void MachineBasicBlock::updateCFIInfo(MachineBasicBlock::iterator Pos) { - // Used for calculating outgoing cfa offset when CFI instruction added at Pos - // is def_cfa or def_cfa_offset. - /* For example: - ... - .cfi_adjust_cfa_offset 4 - ... - .cfi_adjust_cfa_offset 4 - ... - .cfi_def_cfa_offset 16 <---- newly added CFI instruction at Pos - ... - .cfi_adjust_cfa_offset 4 - ... - Once def_cfa_offset is inserted, outgoing cfa offset is no longer - calculated as incoming offset incremented by the sum of all adjustments - (12). It becomes equal to the offset set by the added CFI instruction (16) - incremented by the sum of adjustments below it (4). Adjustments above the - added def_cfa_offset directive don't have effect below it anymore and - therefore don't affect the value of outgoing cfa offset. - */ - int AdjustAmount = 0; - // Used to check if outgoing cfa offset should be updated or not (when def_cfa - // is inserted). - bool ShouldSetOffset = true; - // Used to check if outgoing cfa register should be updated or not (when - // def_cfa is inserted). - bool ShouldSetRegister = true; - const std::vector<MCCFIInstruction> CFIInstructions = - getParent()->getFrameInstructions(); - MCCFIInstruction CFI = CFIInstructions[Pos->getOperand(0).getCFIIndex()]; - // Type of the CFI instruction that was inserted. - MCCFIInstruction::OpType CFIType = CFI.getOperation(); - - // Check if there are already existing CFI instructions below Pos and see if - // outgoing CFI info should be updated or not. - for (MachineBasicBlock::reverse_iterator RI = rbegin(); - RI != Pos.getReverse(); ++RI) { - if (RI->isCFIInstruction()) { - MCCFIInstruction::OpType RIType = - CFIInstructions[RI->getOperand(0).getCFIIndex()].getOperation(); - switch (RIType) { - case MCCFIInstruction::OpAdjustCfaOffset: - AdjustAmount += - CFIInstructions[RI->getOperand(0).getCFIIndex()].getOffset(); - break; - case MCCFIInstruction::OpDefCfaOffset: - // CFI instruction doesn't affect outgoing cfa offset if there is - // already a def_cfa_offset instruction below it. - if (CFIType == MCCFIInstruction::OpDefCfaOffset || - CFIType == MCCFIInstruction::OpAdjustCfaOffset) - return; - if (CFIType == MCCFIInstruction::OpDefCfa) { - // CFI instruction doesn't affect outgoing cfa offset and register - // if there are both def_cfa_offset and def_cfa_register - // instructions below it. - if (!ShouldSetRegister) return; - ShouldSetOffset = false; - } - break; - case MCCFIInstruction::OpDefCfaRegister: - // CFI instruction doesn't affect outgoing cfa register if there is - // already a def_cfa_register instruction below it. - if (CFIType == MCCFIInstruction::OpDefCfaRegister) return; - if (CFIType == MCCFIInstruction::OpDefCfa) { - // CFI instruction doesn't affect outgoing cfa offset and register - // if there are both def_cfa_offset and def_cfa_register - // instructions below it. - if (!ShouldSetOffset) return; - ShouldSetRegister = false; - } - break; - case MCCFIInstruction::OpDefCfa: - // CFI instruction doesn't affect outgoing cfa offset and register if - // there is already a def_cfa instruction below it. - if (CFIType == MCCFIInstruction::OpDefCfaRegister || - CFIType == MCCFIInstruction::OpDefCfaOffset || - CFIType == MCCFIInstruction::OpDefCfa || - CFIType == MCCFIInstruction::OpAdjustCfaOffset) - return; - break; - default: - break; - } - } - } - - // Update the outgoing CFI info based on the added CFI instruction. - switch (CFIType) { - case MCCFIInstruction::OpAdjustCfaOffset: - setOutgoingCFAOffset(getOutgoingCFAOffset() + CFI.getOffset()); - break; - case MCCFIInstruction::OpDefCfaOffset: - setOutgoingCFAOffset(CFI.getOffset() + AdjustAmount); - break; - case MCCFIInstruction::OpDefCfaRegister: - setOutgoingCFARegister(CFI.getRegister()); - break; - case MCCFIInstruction::OpDefCfa: - if (ShouldSetOffset) setOutgoingCFAOffset(CFI.getOffset() + AdjustAmount); - if (ShouldSetRegister) setOutgoingCFARegister(CFI.getRegister()); - break; - default: - break; - } -} - -void MachineBasicBlock::updateCFIInfoSucc() { - // Blocks whose successors' CFI info should be updated. - std::queue<MachineBasicBlock *> Successors; - // Keep track of basic blocks that have already been put in the Successors - // queue. - std::set<MachineBasicBlock *> ProcessedMBBs; - // Start with updating CFI info for direct successors of this block. - Successors.push(this); - ProcessedMBBs.insert(this); - - // Go through the successors and update their CFI info if needed. - while (!Successors.empty()) { - MachineBasicBlock *CurrSucc = Successors.front(); - Successors.pop(); - - // Update CFI info for CurrSucc's successors. - for (auto Succ : CurrSucc->successors()) { - if (ProcessedMBBs.find(Succ) != ProcessedMBBs.end()) continue; - if (Succ->getIncomingCFAOffset() == CurrSucc->getOutgoingCFAOffset() && - Succ->getIncomingCFARegister() == CurrSucc->getOutgoingCFARegister()) - continue; - bool ChangedOutgoingInfo = false; - // Do not update cfa offset if the existing value matches the new. - if (Succ->getIncomingCFAOffset() != CurrSucc->getOutgoingCFAOffset()) { - // If the block doesn't have a def_cfa_offset or def_cfa directive, - // update its outgoing offset. - if (!Succ->hasDefOffset()) { - // Succ block doesn't set absolute offset, so the difference between - // outgoing and incoming offset remains the same. This difference is - // the sum of offsets set by adjust_cfa_offset directives. - int AdjustAmount = - Succ->getOutgoingCFAOffset() - Succ->getIncomingCFAOffset(); - Succ->setOutgoingCFAOffset(CurrSucc->getOutgoingCFAOffset() + - AdjustAmount); - ChangedOutgoingInfo = true; - } - Succ->setIncomingCFAOffset(CurrSucc->getOutgoingCFAOffset()); - } - // Do not update cfa register if the existing value matches the new. - if (Succ->getIncomingCFARegister() != - CurrSucc->getOutgoingCFARegister()) { - Succ->setIncomingCFARegister(CurrSucc->getOutgoingCFARegister()); - // If the block doesn't have a def_cfa_register or def_cfa directive, - // update its outgoing register. - if (!Succ->hasDefRegister()) { - Succ->setOutgoingCFARegister(Succ->getIncomingCFARegister()); - ChangedOutgoingInfo = true; - } - } - // If Succ's outgoing CFI info has been changed, it's successors should be - // updated as well. - if (ChangedOutgoingInfo) { - Successors.push(Succ); - ProcessedMBBs.insert(Succ); - } - } - } -} - -void MachineBasicBlock::recalculateCFIInfo(bool UseExistingIncoming, - int NewIncomingOffset, - unsigned NewIncomingRegister) { - // Outgoing cfa offset set by the block. - int SetOffset; - // Outgoing cfa register set by the block. - unsigned SetRegister; - const std::vector<MCCFIInstruction> &Instrs = - getParent()->getFrameInstructions(); - - // Set initial values to SetOffset and SetRegister. Use existing incoming - // values or values passed as arguments. - if (!UseExistingIncoming) { - // Set new incoming cfa offset and register values. - setIncomingCFAOffset(NewIncomingOffset); - setIncomingCFARegister(NewIncomingRegister); - } - - SetOffset = getIncomingCFAOffset(); - SetRegister = getIncomingCFARegister(); - - setDefOffset(false); - setDefRegister(false); - - // Determine cfa offset and register set by the block. - for (MachineBasicBlock::iterator MI = begin(); MI != end(); ++MI) { - if (MI->isCFIInstruction()) { - unsigned CFIIndex = MI->getOperand(0).getCFIIndex(); - const MCCFIInstruction &CFI = Instrs[CFIIndex]; - if (CFI.getOperation() == MCCFIInstruction::OpDefCfaRegister) { - SetRegister = CFI.getRegister(); - setDefRegister(true); - } else if (CFI.getOperation() == MCCFIInstruction::OpDefCfaOffset) { - SetOffset = CFI.getOffset(); - setDefOffset(true); - } else if (CFI.getOperation() == MCCFIInstruction::OpAdjustCfaOffset) { - SetOffset = SetOffset + CFI.getOffset(); - } else if (CFI.getOperation() == MCCFIInstruction::OpDefCfa) { - SetRegister = CFI.getRegister(); - SetOffset = CFI.getOffset(); - setDefOffset(true); - setDefRegister(true); - } - } - } - - // Update outgoing CFI info. - setOutgoingCFAOffset(SetOffset); - setOutgoingCFARegister(SetRegister); -} - -void MachineBasicBlock::mergeCFIInfo(MachineBasicBlock *MBB) { - // Update CFI info. This basic block acquires MBB's outgoing cfa offset and - // register values. - setOutgoingCFAOffset(MBB->getOutgoingCFAOffset()); - setOutgoingCFARegister(MBB->getOutgoingCFARegister()); - setDefOffset(hasDefOffset() || MBB->hasDefOffset()); - setDefRegister(hasDefRegister() || MBB->hasDefRegister()); -} diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 01fb2a19779..81c6dace92e 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -305,33 +305,8 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const { } case MachineOperand::MO_MCSymbol: return getMCSymbol() == Other.getMCSymbol(); - case MachineOperand::MO_CFIIndex: { - const MachineFunction *MF = getParent()->getParent()->getParent(); - const MachineFunction *OtherMF = - Other.getParent()->getParent()->getParent(); - MCCFIInstruction Inst = MF->getFrameInstructions()[getCFIIndex()]; - MCCFIInstruction OtherInst = - OtherMF->getFrameInstructions()[Other.getCFIIndex()]; - MCCFIInstruction::OpType op = Inst.getOperation(); - if (op != OtherInst.getOperation()) return false; - if (op == MCCFIInstruction::OpDefCfa || op == MCCFIInstruction::OpOffset || - op == MCCFIInstruction::OpRestore || - op == MCCFIInstruction::OpUndefined || - op == MCCFIInstruction::OpSameValue || - op == MCCFIInstruction::OpDefCfaRegister || - op == MCCFIInstruction::OpRelOffset || - op == MCCFIInstruction::OpRegister) - if (Inst.getRegister() != OtherInst.getRegister()) return false; - if (op == MCCFIInstruction::OpRegister) - if (Inst.getRegister2() != OtherInst.getRegister2()) return false; - if (op == MCCFIInstruction::OpDefCfa || op == MCCFIInstruction::OpOffset || - op == MCCFIInstruction::OpRelOffset || - op == MCCFIInstruction::OpDefCfaOffset || - op == MCCFIInstruction::OpAdjustCfaOffset || - op == MCCFIInstruction::OpGnuArgsSize) - if (Inst.getOffset() != OtherInst.getOffset()) return false; - return true; - } + case MachineOperand::MO_CFIIndex: + return getCFIIndex() == Other.getCFIIndex(); case MachineOperand::MO_Metadata: return getMetadata() == Other.getMetadata(); case MachineOperand::MO_IntrinsicID: @@ -380,13 +355,8 @@ hash_code llvm::hash_value(const MachineOperand &MO) { return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getMetadata()); case MachineOperand::MO_MCSymbol: return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getMCSymbol()); - case MachineOperand::MO_CFIIndex: { - const MachineFunction *MF = MO.getParent()->getParent()->getParent(); - MCCFIInstruction Inst = MF->getFrameInstructions()[MO.getCFIIndex()]; - return hash_combine(MO.getType(), MO.getTargetFlags(), Inst.getOperation(), - Inst.getRegister(), Inst.getRegister2(), - Inst.getOffset()); - } + case MachineOperand::MO_CFIIndex: + return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getCFIIndex()); case MachineOperand::MO_IntrinsicID: return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getIntrinsicID()); case MachineOperand::MO_Predicate: diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index d528b01cdff..e9f8d43fe64 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -977,10 +977,6 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) { void PEI::insertPrologEpilogCode(MachineFunction &Fn) { const TargetFrameLowering &TFI = *Fn.getSubtarget().getFrameLowering(); - // Set initial incoming and outgoing cfa offset and register values for basic - // blocks. - TFI.initializeCFIInfo(Fn); - // Add prologue to the function... for (MachineBasicBlock *SaveBlock : SaveBlocks) TFI.emitPrologue(Fn, *SaveBlock); diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp index 62ce903535b..dc7265dcf6c 100644 --- a/llvm/lib/CodeGen/TailDuplicator.cpp +++ b/llvm/lib/CodeGen/TailDuplicator.cpp @@ -604,8 +604,8 @@ bool TailDuplicator::shouldTailDuplicate(bool IsSimple, if (PreRegAlloc && MI.isCall()) return false; - if (!MI.isPHI() && !MI.isDirective()) - InstrCount += 1; + if (!MI.isPHI() && !MI.isDebugValue()) + InstrCount += 1; if (InstrCount > MaxDuplicateCount) return false; @@ -857,9 +857,6 @@ bool TailDuplicator::tailDuplicate(bool IsSimple, MachineBasicBlock *TailBB, for (MachineBasicBlock *Succ : TailBB->successors()) PredBB->addSuccessor(Succ, MBPI->getEdgeProbability(TailBB, Succ)); - // Update the CFI info for PredBB. - PredBB->mergeCFIInfo(TailBB); - Changed = true; ++NumTailDups; } @@ -920,9 +917,6 @@ bool TailDuplicator::tailDuplicate(bool IsSimple, MachineBasicBlock *TailBB, PrevBB->transferSuccessors(TailBB); TDBBs.push_back(PrevBB); Changed = true; - - // Update the CFI info for PrevBB. - PrevBB->mergeCFIInfo(TailBB); } // If this is after register allocation, there are no phis to fix. diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index b95ef25d7ee..817e58ce59e 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -769,15 +769,8 @@ void TargetPassConfig::addMachinePasses() { if (getOptLevel() != CodeGenOpt::None) addBlockPlacement(); - // Verify basic block incoming and outgoing cfa offset and register values. - addPass(createCFIInfoVerifier()); - addPreEmitPass(); - // Correct CFA calculation rule where needed by inserting appropriate CFI - // instructions. - addPass(createCFIInstrInserter(), false); - if (TM->Options.EnableIPRA) // Collect register usage information and produce a register mask of // clobbered registers, to be used to optimize call sites. diff --git a/llvm/lib/Target/X86/X86CallFrameOptimization.cpp b/llvm/lib/Target/X86/X86CallFrameOptimization.cpp index a7d157b0dad..765af67de16 100644 --- a/llvm/lib/Target/X86/X86CallFrameOptimization.cpp +++ b/llvm/lib/Target/X86/X86CallFrameOptimization.cpp @@ -234,12 +234,6 @@ bool X86CallFrameOptimization::runOnMachineFunction(MachineFunction &MF) { assert(isPowerOf2_32(SlotSize) && "Expect power of 2 stack slot size"); Log2SlotSize = Log2_32(SlotSize); - // Set initial incoming and outgoing cfa offset and register values for basic - // blocks. This is done here because this pass runs before PEI and can insert - // CFI instructions. - // TODO: Find a better solution to this problem. - TFL->initializeCFIInfo(MF); - if (skipFunction(*MF.getFunction()) || !isLegal(MF)) return false; @@ -542,13 +536,11 @@ void X86CallFrameOptimization::adjustCallSequence(MachineFunction &MF, // For debugging, when using SP-based CFA, we need to adjust the CFA // offset after each push. // TODO: This is needed only if we require precise CFA. - if (!TFL->hasFP(MF)) { - TFL->BuildCFI(MBB, std::next(Push), DL, - MCCFIInstruction::createAdjustCfaOffset(nullptr, SlotSize)); - // Update the CFI information for MBB and it's successors. - MBB.updateCFIInfo(std::next(Push)); - MBB.updateCFIInfoSucc(); - } + if (!TFL->hasFP(MF)) + TFL->BuildCFI( + MBB, std::next(Push), DL, + MCCFIInstruction::createAdjustCfaOffset(nullptr, SlotSize)); + MBB.erase(MOV); } diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index feac493aa90..e3aa227702b 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -958,8 +958,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, ? getX86SubSuperRegister(FramePtr, 64) : FramePtr; unsigned BasePtr = TRI->getBaseRegister(); bool HasWinCFI = false; - bool InsertedCFI = false; - + // Debug location must be unknown since the first debug location is used // to determine the end of the prologue. DebugLoc DL; @@ -1094,9 +1093,6 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, assert(StackSize); BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createDefCfaOffset(nullptr, 2 * stackGrowth)); - MBB.setDefOffset(true); - MBB.updateCFIInfo(std::prev(MBBI)); - InsertedCFI = true; // Change the rule for the FramePtr to be an "offset" rule. unsigned DwarfFramePtr = TRI->getDwarfRegNum(MachineFramePtr, true); @@ -1125,9 +1121,6 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, unsigned DwarfFramePtr = TRI->getDwarfRegNum(MachineFramePtr, true); BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createDefCfaRegister( nullptr, DwarfFramePtr)); - MBB.setDefRegister(true); - MBB.updateCFIInfo(std::prev(MBBI)); - InsertedCFI = true; } } } else { @@ -1159,9 +1152,6 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, assert(StackSize); BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createDefCfaOffset(nullptr, StackOffset)); - MBB.setDefOffset(true); - MBB.updateCFIInfo(std::prev(MBBI)); - InsertedCFI = true; StackOffset += stackGrowth; } @@ -1427,9 +1417,6 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, assert(StackSize); BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createDefCfaOffset( nullptr, -StackSize + stackGrowth)); - MBB.setDefOffset(true); - MBB.updateCFIInfo(std::prev(MBBI)); - InsertedCFI = true; } // Emit DWARF info specifying the offsets of the callee-saved registers. @@ -1451,9 +1438,6 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, // At this point we know if the function has WinCFI or not. MF.setHasWinCFI(HasWinCFI); - - if (InsertedCFI) - MBB.updateCFIInfoSucc(); } bool X86FrameLowering::canUseLEAForSPInEpilogue( @@ -1564,12 +1548,6 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, unsigned CSSize = X86FI->getCalleeSavedFrameSize(); uint64_t NumBytes = 0; - bool NeedsDwarfCFI = (MF.getMMI().hasDebugInfo() || - MF.getFunction()->needsUnwindTableEntry()) && - (!MF.getSubtarget<X86Subtarget>().isTargetDarwin() && - !MF.getSubtarget<X86Subtarget>().isOSWindows()); - bool InsertedCFI = false; - if (RetOpcode && *RetOpcode == X86::CATCHRET) { // SEH shouldn't use catchret. assert(!isAsynchronousEHPersonality( @@ -1604,17 +1582,6 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::POP64r : X86::POP32r), MachineFramePtr) .setMIFlag(MachineInstr::FrameDestroy); - if (NeedsDwarfCFI) { - unsigned DwarfStackPtr = - TRI->getDwarfRegNum(Is64Bit ? X86::RSP : X86::ESP, true); - BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createDefCfa( - nullptr, DwarfStackPtr, -SlotSize)); - --MBBI; - MBB.setDefOffset(true); - MBB.setDefRegister(true); - MBB.updateCFIInfo(MBBI); - InsertedCFI = true; - } } else { NumBytes = StackSize - CSSize; } @@ -1699,14 +1666,6 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, } else if (NumBytes) { // Adjust stack pointer back: ESP += numbytes. emitSPUpdate(MBB, MBBI, NumBytes, /*InEpilogue=*/true); - if (!hasFP(MF) && NeedsDwarfCFI) { - // Define the current CFA rule to use the provided offset. - BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createDefCfaOffset( - nullptr, -CSSize - SlotSize)); - MBB.setDefOffset(true); - MBB.updateCFIInfo(std::prev(MBBI)); - InsertedCFI = true; - } --MBBI; } @@ -1719,26 +1678,6 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, if (NeedsWinCFI && MF.hasWinCFI()) BuildMI(MBB, MBBI, DL, TII.get(X86::SEH_Epilogue)); - if (!hasFP(MF) && NeedsDwarfCFI) { - MBBI = FirstCSPop; - int64_t Offset = -CSSize - SlotSize; - // Mark callee-saved pop instruction. - // Define the current CFA rule to use the provided offset. - while (MBBI != MBB.end()) { - MachineBasicBlock::iterator PI = MBBI; - unsigned Opc = PI->getOpcode(); - ++MBBI; - if (Opc == X86::POP32r || Opc == X86::POP64r) { - Offset += SlotSize; - BuildCFI(MBB, MBBI, DL, - MCCFIInstruction::createDefCfaOffset(nullptr, Offset)); - MBB.setDefOffset(true); - MBB.updateCFIInfo(std::prev(MBBI)); - InsertedCFI = true; - } - } - } - if (!RetOpcode || !isTailCallOpcode(*RetOpcode)) { // Add the return addr area delta back since we are not tail calling. int Offset = -1 * X86FI->getTCReturnAddrDelta(); @@ -1751,9 +1690,6 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, emitSPUpdate(MBB, MBBI, Offset, /*InEpilogue=*/true); } } - - if (InsertedCFI) - MBB.updateCFIInfoSucc(); } int X86FrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI, @@ -2428,19 +2364,6 @@ void X86FrameLowering::adjustForSegmentedStacks( checkMBB->addSuccessor(allocMBB); checkMBB->addSuccessor(&PrologueMBB); - int InitialOffset = TRI->getSlotSize(); - unsigned InitialRegister = TRI->getDwarfRegNum(StackPtr, true); - // Set CFI info for checkMBB. - checkMBB->setIncomingCFAOffset(InitialOffset); - checkMBB->setIncomingCFARegister(InitialRegister); - checkMBB->setOutgoingCFAOffset(InitialOffset); - checkMBB->setOutgoingCFARegister(InitialRegister); - // Set CFI info for allocMBB. - allocMBB->setIncomingCFAOffset(InitialOffset); - allocMBB->setIncomingCFARegister(InitialRegister); - allocMBB->setOutgoingCFAOffset(InitialOffset); - allocMBB->setOutgoingCFARegister(InitialRegister); - #ifdef EXPENSIVE_CHECKS MF.verify(); #endif @@ -2612,19 +2535,6 @@ void X86FrameLowering::adjustForHiPEPrologue( stackCheckMBB->addSuccessor(incStackMBB, {1, 100}); incStackMBB->addSuccessor(&PrologueMBB, {99, 100}); incStackMBB->addSuccessor(incStackMBB, {1, 100}); - - int InitialOffset = TRI->getSlotSize(); - unsigned InitialRegister = TRI->getDwarfRegNum(StackPtr, true); - // Set CFI info to stackCheckMBB. - stackCheckMBB->setIncomingCFAOffset(InitialOffset); - stackCheckMBB->setIncomingCFARegister(InitialRegister); - stackCheckMBB->setOutgoingCFAOffset(InitialOffset); - stackCheckMBB->setOutgoingCFARegister(InitialRegister); - // Set CFI info to incStackMBB. - incStackMBB->setIncomingCFAOffset(InitialOffset); - incStackMBB->setIncomingCFARegister(InitialRegister); - incStackMBB->setOutgoingCFAOffset(InitialOffset); - incStackMBB->setOutgoingCFARegister(InitialRegister); } #ifdef EXPENSIVE_CHECKS MF.verify(); @@ -2730,7 +2640,6 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, bool WindowsCFI = MF.getTarget().getMCAsmInfo()->usesWindowsCFI(); bool DwarfCFI = !WindowsCFI && (MMI.hasDebugInfo() || Fn->needsUnwindTableEntry()); - bool InsertedCFI = false; // If we have any exception handlers in this function, and we adjust // the SP before calls, we may need to indicate this to the unwinder @@ -2756,12 +2665,10 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, // TODO: This is needed only if we require precise CFA. // If this is a callee-pop calling convention, emit a CFA adjust for // the amount the callee popped. - if (isDestroy && InternalAmt && DwarfCFI && !hasFP(MF)) { + if (isDestroy && InternalAmt && DwarfCFI && !hasFP(MF)) BuildCFI(MBB, InsertPos, DL, MCCFIInstruction::createAdjustCfaOffset(nullptr, -InternalAmt)); - MBB.updateCFIInfo(std::prev(InsertPos)); - InsertedCFI = true; - } + // Add Amount to SP to destroy a frame, or subtract to setup. int64_t StackAdjustment = isDestroy ? Amount : -Amount; int64_t CfaAdjustment = -StackAdjustment; @@ -2795,13 +2702,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, BuildCFI(MBB, InsertPos, DL, MCCFIInstruction::createAdjustCfaOffset(nullptr, CfaAdjustment)); - MBB.updateCFIInfo(std::prev(InsertPos)); - InsertedCFI = true; } } - if (InsertedCFI) MBB.updateCFIInfoSucc(); - return I; } @@ -2923,22 +2826,6 @@ MachineBasicBlock::iterator X86FrameLowering::restoreWin32EHStackPointers( return MBBI; } -void X86FrameLowering::initializeCFIInfo(MachineFunction &MF) const { - int InitialOffset = TRI->getSlotSize(); - unsigned InitialRegister = TRI->getDwarfRegNum(StackPtr, true); - // Initialize CFI info if it hasn't already been initialized. - for (auto &MBB : MF) { - if (MBB.getIncomingCFAOffset() == -1) - MBB.setIncomingCFAOffset(InitialOffset); - if (MBB.getOutgoingCFAOffset() == -1) - MBB.setOutgoingCFAOffset(InitialOffset); - if (MBB.getIncomingCFARegister() == 0) - MBB.setIncomingCFARegister(InitialRegister); - if (MBB.getOutgoingCFARegister() == 0) - MBB.setOutgoingCFARegister(InitialRegister); - } -} - namespace { // Struct used by orderFrameObjects to help sort the stack objects. struct X86FrameSortingObject { diff --git a/llvm/lib/Target/X86/X86FrameLowering.h b/llvm/lib/Target/X86/X86FrameLowering.h index 60edf842980..7d214cabad5 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.h +++ b/llvm/lib/Target/X86/X86FrameLowering.h @@ -177,8 +177,6 @@ public: MachineBasicBlock::iterator MBBI, const DebugLoc &DL, bool RestoreSP = false) const; - void initializeCFIInfo(MachineFunction &MF) const override; - private: uint64_t calculateMaxStackAlign(const MachineFunction &MF) const; |