summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-03-09 00:48:33 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-03-09 00:48:33 +0000
commit2adc5b6a17268834b08fda444b1a84550e8c5ae8 (patch)
treeed1fb5ac8ad6f42756bf8e23b079f4eb890d01f9 /lib/Transforms
parente11128dd9d85b595b3fa03d0d8a52f0ae62cc11c (diff)
downloadllvm-2adc5b6a17268834b08fda444b1a84550e8c5ae8.tar.gz
llvm-2adc5b6a17268834b08fda444b1a84550e8c5ae8.tar.bz2
llvm-2adc5b6a17268834b08fda444b1a84550e8c5ae8.tar.xz
PR9420; an instruction before an unreachable is guaranteed not to have any
reachable uses, but there still might be uses in dead blocks. Use the standard solution of replacing all the uses with undef. This is a rare case because it's very sensitive to phase ordering in SimplifyCFG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 72fa468db6..09f4fb2e13 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2168,7 +2168,9 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) {
if (LI->isVolatile())
break;
- // Delete this instruction
+ // Delete this instruction (any uses are guaranteed to be dead)
+ if (!BBI->use_empty())
+ BBI->replaceAllUsesWith(UndefValue::get(BBI->getType()));
BBI->eraseFromParent();
Changed = true;
}