summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-04-30 18:58:23 +0000
committerPete Cooper <peter_cooper@apple.com>2015-04-30 18:58:23 +0000
commit4d8d2ec3ebf2334e8f16b4d702e3e6e6788c4a3e (patch)
treec6c3ff497ccb28a80bbe56b7d91b81ed95ade295 /llvm/lib/CodeGen/BranchFolding.cpp
parent0a905042cd87017ddf7449d9659dd4fcc17acefe (diff)
downloadbcm5719-llvm-4d8d2ec3ebf2334e8f16b4d702e3e6e6788c4a3e.tar.gz
bcm5719-llvm-4d8d2ec3ebf2334e8f16b4d702e3e6e6788c4a3e.zip
Don't rewrite jumps to empty BBs to landing pads.
In the test case here, the 'unreachable' BB was removed by BranchFolding because its empty. It then rewrote the jump from 'entry' to jump to its fallthrough, which was a landing pad. This results in 'entry' jumping to 2 different landing pads, which fails the machine verifier. rdar://problem/20750162 llvm-svn: 236248
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index abe7ca1610c..3b22d31746c 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -1203,6 +1203,11 @@ ReoptimizeBlock:
if (FallThrough == MF.end()) {
// TODO: Simplify preds to not branch here if possible!
+ } else if (FallThrough->isLandingPad()) {
+ // Don't rewrite to a landing pad fallthough. That could lead to the case
+ // where a BB jumps to more than one landing pad.
+ // TODO: Is it ever worth rewriting predecessors which don't already
+ // jump to a landing pad, and so can safely jump to the fallthrough?
} else {
// Rewrite all predecessors of the old block to go to the fallthrough
// instead.
OpenPOWER on IntegriCloud