Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1439,8 +1439,14 @@ OutStreamer->EmitLabel(GetJTISymbol(JTI)); - for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) + for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) { + // If a JTBB has a number of -1 it was pruned as unreachable during + // optimization. It is not feasible to remove the BB from the JT + // table during pruning, so simply ignore unreachable JTBBs here. + if (JTBBs[ii]->getNumber() == -1) + continue; EmitJumpTableEntry(MJTI, JTBBs[ii], JTI); + } } if (!JTInDiffSection) OutStreamer->EmitDataRegion(MCDR_DataRegionEnd);