• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; This tests that unreachable basic blocks are pruned from the CFG, so that
2; liveness analysis doesn't detect inconsistencies.
3
4; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
5; RUN:      -allow-externally-defined-symbols | FileCheck %s
6; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
7; RUN:      -allow-externally-defined-symbols | FileCheck %s
8
9declare void @abort()
10
11define internal i32 @unreachable_block() {
12entry:
13  ; ret_val has no reaching uses and so its assignment may be
14  ; dead-code eliminated.
15  %ret_val = add i32 undef, undef
16  call void @abort()
17  unreachable
18label:
19  ; ret_val has no reaching definitions, causing an inconsistency in
20  ; liveness analysis.
21  ret i32 %ret_val
22}
23
24; CHECK-LABEL: unreachable_block
25