diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 04117d3c059a..035c31e7de43 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -55,6 +55,9 @@ bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM, PM.add(createLowerConstantExpressionsPass()); + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + PM.add(createPPCSimpleInstructionSelector(*this)); if (PrintMachineCode) @@ -86,6 +89,9 @@ void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { PM.add(createLowerConstantExpressionsPass()); + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + PM.add(createPPCSimpleInstructionSelector(TM)); PM.add(createRegisterAllocator()); PM.add(createPrologEpilogCodeInserter());