Home | History | Annotate | Download | only in Bitcode
      1 ; RUN:  llvm-dis < %s.bc| FileCheck %s
      2 
      3 ; TerminatorOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
      4 ; The test checks that LLVM does not misread terminator instructions from
      5 ; older bitcode files.
      6 
      7 define i32 @condbr(i1 %cond){
      8 entry:
      9 ; CHECK: br i1 %cond, label %TrueLabel, label %FalseLabel
     10   br i1 %cond, label %TrueLabel, label %FalseLabel
     11   
     12   TrueLabel:
     13   ret i32 1
     14   
     15   FalseLabel:
     16   ret i32 0
     17 }
     18 
     19 define i32 @uncondbr(){
     20 entry:
     21 ; CHECK: br label %uncondLabel
     22   br label %uncondLabel
     23   
     24   uncondLabel:
     25   ret i32 1
     26 }
     27 
     28 define i32 @indirectbr(i8* %Addr){
     29 entry:
     30 ; CHECK: indirectbr i8* %Addr, [label %bb1, label %bb2]
     31   indirectbr i8* %Addr, [ label %bb1, label %bb2 ]
     32   
     33   bb1:
     34   ret i32 1
     35   
     36   bb2:
     37   ret i32 0
     38 }
     39 
     40 define void @unreachable(){
     41 entry:
     42 ; CHECK: unreachable
     43   unreachable
     44   
     45   ret void
     46 }
     47 
     48 define i32 @retInstr(){
     49 entry:
     50 ; CHECK: ret i32 1 
     51   ret i32 1 
     52 }
     53 
     54 define void @retInstr2(){
     55 entry:
     56 ; CHECK: ret void 
     57   ret void
     58 }
     59 
     60 define i32 @switchInstr(i32 %x){
     61 entry:
     62 ; CHECK: switch i32 %x, label %label3 [
     63   switch i32 %x, label %label3 [
     64 ; CHECK-NEXT: i32 1, label %label1   
     65   i32 1, label %label1
     66 ; CHECK-NEXT: i32 2, label %label2  
     67   i32 2, label %label2
     68   ]
     69 label1:
     70   ret i32 1
     71 label2:
     72   ret i32 2
     73 label3:
     74   ret i32 0
     75 }
     76 
     77