summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-07-05 22:28:28 +0000
committerDavide Italiano <davide@freebsd.org>2017-07-05 22:28:28 +0000
commit7dd0694f96ec3e6fd9c05f066e5ae9b706678257 (patch)
tree8782bc6674a04499ff193129fb07e562d2174d6f /llvm/test
parentcf7347379f00c8a0872207c94ab07595e5db1c5b (diff)
downloadbcm5719-llvm-7dd0694f96ec3e6fd9c05f066e5ae9b706678257.tar.gz
bcm5719-llvm-7dd0694f96ec3e6fd9c05f066e5ae9b706678257.zip
[GlobalOpt] Remove unreachable blocks before optimizing a function.
LLVM's definition of dominance allows instructions that are cyclic in unreachable blocks, e.g.: %pat = select i1 %condition, @global, i16* %pat because any instruction dominates an instruction in a block that's not reachable from entry. So, remove unreachable blocks from the function, because a) there's no point in analyzing them and b) GlobalOpt should otherwise grow some more complicated logic to break these cycles. Differential Revision: https://reviews.llvm.org/D35028 llvm-svn: 307215
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/GlobalOpt/pr33686.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/Transforms/GlobalOpt/pr33686.ll b/llvm/test/Transforms/GlobalOpt/pr33686.ll
new file mode 100644
index 00000000000..153a85f8e0c
--- /dev/null
+++ b/llvm/test/Transforms/GlobalOpt/pr33686.ll
@@ -0,0 +1,17 @@
+; RUN: opt -S -globalopt %s | FileCheck %s
+
+; CHECK-LABEL: define void @beth
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret void
+; CHEC-NEXT: }
+
+@glob = external global i16, align 1
+
+define void @beth() {
+entry:
+ ret void
+
+notreachable:
+ %patatino = select i1 undef, i16* @glob, i16* %patatino
+ br label %notreachable
+}
OpenPOWER on IntegriCloud