Skip to content

Commit

Permalink
Revert "[CodeGen] Async unwind - add a pass to fix CFI information"
Browse files Browse the repository at this point in the history
This reverts commit 980c3e6.

This commit had failing tests with clang crashing across various
AArch64/Linux buildots.

https://lab.llvm.org/buildbot/#/builders/179/builds/3346

Differential Revision: https://reviews.llvm.org/D114545
  • Loading branch information
omjavaid committed Apr 5, 2022
1 parent 64f659b commit 0320115
Show file tree
Hide file tree
Showing 27 changed files with 15 additions and 959 deletions.
38 changes: 0 additions & 38 deletions llvm/include/llvm/CodeGen/CFIFixup.h

This file was deleted.

3 changes: 0 additions & 3 deletions llvm/include/llvm/CodeGen/Passes.h
Expand Up @@ -494,9 +494,6 @@ namespace llvm {
// This pass expands indirectbr instructions.
FunctionPass *createIndirectBrExpandPass();

/// Creates CFI Fixup pass. \see CFIFixup.cpp
FunctionPass *createCFIFixup();

/// Creates CFI Instruction Inserter pass. \see CFIInstrInserter.cpp
FunctionPass *createCFIInstrInserter();

Expand Down
8 changes: 0 additions & 8 deletions llvm/include/llvm/CodeGen/TargetFrameLowering.h
Expand Up @@ -223,14 +223,6 @@ class TargetFrameLowering {
emitCalleeSavedFrameMovesFullCFA(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI) const {}

/// Returns true if we may need to fix the unwind infportmation for the
/// function.
virtual bool enableCFIFixup(MachineFunction &MF) const;

/// Emit CFI instructions that recreate the state of the unwind information
/// upon fucntion entry.
virtual void resetCFIToInitialState(MachineBasicBlock &MBB) const {}

/// Replace a StackProbe stub (if any) with the actual probe code inline
virtual void inlineStackProbe(MachineFunction &MF,
MachineBasicBlock &PrologueMBB) const {}
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/InitializePasses.h
Expand Up @@ -103,7 +103,6 @@ void initializeCFGSimplifyPassPass(PassRegistry&);
void initializeCFGuardPass(PassRegistry&);
void initializeCFGuardLongjmpPass(PassRegistry&);
void initializeCFGViewerLegacyPassPass(PassRegistry&);
void initializeCFIFixupPass(PassRegistry&);
void initializeCFIInstrInserterPass(PassRegistry&);
void initializeCFLAndersAAWrapperPassPass(PassRegistry&);
void initializeCFLSteensAAWrapperPassPass(PassRegistry&);
Expand Down
2 changes: 0 additions & 2 deletions llvm/include/llvm/Target/TargetMachine.h
Expand Up @@ -257,8 +257,6 @@ class TargetMachine {
Options.SupportsDebugEntryValues = Enable;
}

void setCFIFixup(bool Enable) { Options.EnableCFIFixup = Enable; }

bool getAIXExtendedAltivecABI() const {
return Options.EnableAIXExtendedAltivecABI;
}
Expand Down
4 changes: 0 additions & 4 deletions llvm/include/llvm/Target/TargetOptions.h
Expand Up @@ -144,7 +144,6 @@ namespace llvm {
ValueTrackingVariableLocations(false), ForceDwarfFrameSection(false),
XRayOmitFunctionIndex(false), DebugStrictDwarf(false),
Hotpatch(false), PPCGenScalarMASSEntries(false), JMCInstrument(false),
EnableCFIFixup(false),
FPDenormalMode(DenormalMode::IEEE, DenormalMode::IEEE) {}

/// DisableFramePointerElim - This returns true if frame pointer elimination
Expand Down Expand Up @@ -357,9 +356,6 @@ namespace llvm {
/// Enable JustMyCode instrumentation.
unsigned JMCInstrument : 1;

/// Enable the CFIFixup pass.
unsigned EnableCFIFixup : 1;

/// Name of the stack usage file (i.e., .su file) if user passes
/// -fstack-usage. If empty, it can be implied that -fstack-usage is not
/// passed on the command line.
Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
Expand Up @@ -273,12 +273,6 @@ void AsmPrinter::emitCFIInstruction(const MCCFIInstruction &Inst) const {
case MCCFIInstruction::OpUndefined:
OutStreamer->emitCFIUndefined(Inst.getRegister());
break;
case MCCFIInstruction::OpRememberState:
OutStreamer->emitCFIRememberState();
break;
case MCCFIInstruction::OpRestoreState:
OutStreamer->emitCFIRestoreState();
break;
}
}

Expand Down
215 changes: 0 additions & 215 deletions llvm/lib/CodeGen/CFIFixup.cpp

This file was deleted.

1 change: 0 additions & 1 deletion llvm/lib/CodeGen/CMakeLists.txt
Expand Up @@ -38,7 +38,6 @@ add_llvm_component_library(LLVMCodeGen
CalcSpillWeights.cpp
CallingConvLower.cpp
CFGuardLongjmp.cpp
CFIFixup.cpp
CFIInstrInserter.cpp
CodeGen.cpp
CodeGenCommonISel.cpp
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/CodeGen/CodeGen.cpp
Expand Up @@ -24,7 +24,6 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
initializeBranchFolderPassPass(Registry);
initializeBranchRelaxationPass(Registry);
initializeCFGuardLongjmpPass(Registry);
initializeCFIFixupPass(Registry);
initializeCFIInstrInserterPass(Registry);
initializeCheckDebugMachineModulePass(Registry);
initializeCodeGenPreparePass(Registry);
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/CodeGen/TailDuplicator.cpp
Expand Up @@ -383,9 +383,8 @@ void TailDuplicator::duplicateInstruction(
// Allow duplication of CFI instructions.
if (MI->isCFIInstruction()) {
BuildMI(*PredBB, PredBB->end(), PredBB->findDebugLoc(PredBB->begin()),
TII->get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(MI->getOperand(0).getCFIIndex())
.setMIFlags(MI->getFlags());
TII->get(TargetOpcode::CFI_INSTRUCTION)).addCFIIndex(
MI->getOperand(0).getCFIIndex());
return;
}
MachineInstr &NewMI = TII->duplicate(*PredBB, PredBB->end(), *MI);
Expand Down
7 changes: 0 additions & 7 deletions llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp
Expand Up @@ -21,8 +21,6 @@
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
Expand All @@ -38,11 +36,6 @@ bool TargetFrameLowering::enableCalleeSaveSkip(const MachineFunction &MF) const
return false;
}

bool TargetFrameLowering::enableCFIFixup(MachineFunction &MF) const {
return MF.needsFrameMoves() &&
!MF.getTarget().getMCAsmInfo()->usesWindowsCFI();
}

/// Returns the displacement from the frame register to the stack
/// frame of the specified index, along with the frame register used
/// (in output arg FrameReg). This is the default implementation which
Expand Down
8 changes: 0 additions & 8 deletions llvm/lib/CodeGen/TargetPassConfig.cpp
Expand Up @@ -138,11 +138,6 @@ static cl::opt<RunOutliner> EnableMachineOutliner(
"Disable all outlining"),
// Sentinel value for unspecified option.
clEnumValN(RunOutliner::AlwaysOutline, "", "")));
// Disable the pass to fix unwind information. Whether the pass is included in
// the pipeline is controlled via the target options, this option serves as
// manual override.
static cl::opt<bool> DisableCFIFixup("disable-cfi-fixup", cl::Hidden,
cl::desc("Disable the CFI fixup pass"));
// Enable or disable FastISel. Both options are needed, because
// FastISel is enabled by default with -fast, and we wish to be
// able to enable or disable fast-isel independently from -O0.
Expand Down Expand Up @@ -1280,9 +1275,6 @@ void TargetPassConfig::addMachinePasses() {
addPass(createMachineFunctionSplitterPass());
}

if (!DisableCFIFixup && TM->Options.EnableCFIFixup)
addPass(createCFIFixup());

// Add passes that directly emit MI after all other MI passes.
addPreEmitPass2();

Expand Down

0 comments on commit 0320115

Please sign in to comment.