diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index 04117d3c059..035c31e7de4 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/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());