Index: include/llvm/CodeGen/MachineInstr.h =================================================================== --- include/llvm/CodeGen/MachineInstr.h +++ include/llvm/CodeGen/MachineInstr.h @@ -764,9 +764,14 @@ bool isEHLabel() const { return getOpcode() == TargetOpcode::EH_LABEL; } bool isGCLabel() const { return getOpcode() == TargetOpcode::GC_LABEL; } + bool isLocalEscape() const { + return getOpcode() == TargetOpcode::LOCAL_ESCAPE; + } /// Returns true if the MachineInstr represents a label. - bool isLabel() const { return isEHLabel() || isGCLabel(); } + bool isLabel() const { + return isEHLabel() || isGCLabel() || isLocalEscape(); + } bool isCFIInstruction() const { return getOpcode() == TargetOpcode::CFI_INSTRUCTION; } Index: lib/CodeGen/DeadMachineInstructionElim.cpp =================================================================== --- lib/CodeGen/DeadMachineInstructionElim.cpp +++ lib/CodeGen/DeadMachineInstructionElim.cpp @@ -64,10 +64,6 @@ if (MI->isInlineAsm()) return false; - // Don't delete frame allocation labels. - if (MI->getOpcode() == TargetOpcode::LOCAL_ESCAPE) - return false; - // Don't delete instructions with side effects. bool SawStore = false; if (!MI->isSafeToMove(nullptr, SawStore) && !MI->isPHI())