[Attributor] Use existing unreachable instead of introducing new ones
So far we split the unreachable off and placed a new one, this is not
necessary.
llvm-svn: 369575
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 16894d8..82a6eba 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1631,6 +1631,9 @@
Instruction *I = const_cast<Instruction *>(NRC);
BasicBlock *BB = I->getParent();
Instruction *SplitPos = I->getNextNode();
+ // TODO: mark stuff before unreachable instructions as dead.
+ if (isa_and_nonnull<UnreachableInst>(SplitPos))
+ continue;
if (auto *II = dyn_cast<InvokeInst>(I)) {
// If we keep the invoke the split position is at the beginning of the