diff options
author | Andrew Litteken <andrew_litteken@apple.com> | 2020-04-09 18:06:38 -0700 |
---|---|---|
committer | Andrew Litteken <andrew_litteken@apple.com> | 2020-04-17 22:26:34 -0700 |
commit | 8d5024f7fe721513c4332048e6836cd408581a61 (patch) | |
tree | ffb7435297c3bebfe99b166aa2b35b27026a4cf3 /llvm/lib/CodeGen/MachineOutliner.cpp | |
parent | fb42d3afad1d9f09bcb90680baa77a39ecb99140 (diff) | |
download | llvm-8d5024f7fe721513c4332048e6836cd408581a61.zip llvm-8d5024f7fe721513c4332048e6836cd408581a61.tar.gz llvm-8d5024f7fe721513c4332048e6836cd408581a61.tar.bz2 |
fix to outline cfi instruction when can be grouped in a tail call
[MachineOutliner] fix test for excluding CFI and add test to include CFI in outlining
New test to check that we only outline CFI instruction if all CFI
Instructions in the function would be captured by the outlining
adding x86 tests analagous to AARCH64 cfi tests
Revision: https://reviews.llvm.org/D77852
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineOutliner.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index d63f194..bd30bd4 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -1160,9 +1160,17 @@ MachineFunction *MachineOutliner::createOutlinedFunction( // Insert the new function into the module. MF.insert(MF.begin(), &MBB); + MachineFunction *OriginalMF = FirstCand.front()->getMF(); + const std::vector<MCCFIInstruction> &Instrs = + OriginalMF->getFrameInstructions(); for (auto I = FirstCand.front(), E = std::next(FirstCand.back()); I != E; ++I) { MachineInstr *NewMI = MF.CloneMachineInstr(&*I); + if (I->isCFIInstruction()) { + unsigned CFIIndex = NewMI->getOperand(0).getCFIIndex(); + MCCFIInstruction CFI = Instrs[CFIIndex]; + (void)MF.addFrameInst(CFI); + } NewMI->dropMemRefs(MF); // Don't keep debug information for outlined instructions. @@ -1331,7 +1339,6 @@ bool MachineOutliner::outline(Module &M, } LLVM_DEBUG(dbgs() << "OutlinedSomething = " << OutlinedSomething << "\n";); - return OutlinedSomething; } |