Revert "Revert r241570, it caused PR24053"
[oota-llvm.git] / lib / Transforms / Scalar / SCCP.cpp
index 305175ff8f73c85a84183d137c872a09a6655ae3..4d3a708fa20ecc1614af841518d43a51453c7537 100644 (file)
@@ -1799,11 +1799,10 @@ bool IPSCCP::runOnModule(Module &M) {
         if (!TI->use_empty())
           TI->replaceAllUsesWith(UndefValue::get(TI->getType()));
         TI->eraseFromParent();
+        new UnreachableInst(M.getContext(), BB);
 
         if (&*BB != &F->front())
           BlocksToErase.push_back(BB);
-        else
-          new UnreachableInst(M.getContext(), BB);
         continue;
       }