Home | History | Annotate | Download | only in llvm2ice_tests
      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 
      9 declare void @abort()
     10 
     11 define internal i32 @unreachable_block() {
     12 entry:
     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
     18 label:
     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