Home | History | Annotate | Download | only in X86
      1 # RUN: llc -mtriple=x86_64-- -verify-machineinstrs -run-pass block-placement -o - %s | FileCheck %s
      2 # Check the conditional jump in bb.1 is changed to unconditional after block placement swaps bb.2 and bb.3.
      3 
      4 --- |
      5   @a = external global i16
      6   @b = external global i32
      7 
      8   declare void @dummy1()
      9   declare void @dummy2()
     10   declare void @dummy3()
     11 
     12   ; Function Attrs: nounwind
     13   define void @f2() {
     14     br i1 undef, label %bb1, label %bb3
     15 
     16   bb1:
     17     call void @dummy1()
     18     call void @dummy1()
     19     call void @dummy1()
     20     br i1 undef, label %bb2, label %bb2
     21 
     22   bb2:
     23     call void @dummy2()
     24     call void @dummy2()
     25     call void @dummy2()
     26     br label %bb4
     27 
     28   bb3:
     29     call void @dummy3()
     30     call void @dummy3()
     31     call void @dummy3()
     32     br label %bb2
     33 
     34   bb4:
     35     ret void
     36   }
     37 
     38 
     39 ...
     40 ---
     41 # CHECK-LABEL: name: f2
     42 # CHECK: bb.1:
     43 # CHECK: JMP_1 %bb.2
     44 # CHECK: bb.3:
     45 # CHECK: bb.2:
     46 name:            f2
     47 body:             |
     48   bb.0 (%ir-block.0):
     49     successors: %bb.1(50), %bb.3(50)
     50 
     51     JNE_1 %bb.1, implicit $eflags
     52     JMP_1 %bb.3
     53   bb.1:
     54     successors: %bb.2(100)
     55 
     56     CALL64pcrel32 @dummy1, csr_64, implicit $rsp, implicit-def $rsp
     57     CALL64pcrel32 @dummy1, csr_64, implicit $rsp, implicit-def $rsp
     58     CALL64pcrel32 @dummy1, csr_64, implicit $rsp, implicit-def $rsp
     59     JNE_1 %bb.2, implicit $eflags
     60 
     61   bb.2:
     62     successors: %bb.4(100)
     63 
     64     CALL64pcrel32 @dummy2, csr_64, implicit $rsp, implicit-def $rsp
     65     CALL64pcrel32 @dummy2, csr_64, implicit $rsp, implicit-def $rsp
     66     CALL64pcrel32 @dummy2, csr_64, implicit $rsp, implicit-def $rsp
     67     JMP_1 %bb.4
     68 
     69   bb.3:
     70     successors: %bb.2(100)
     71     CALL64pcrel32 @dummy3, csr_64, implicit $rsp, implicit-def $rsp
     72     CALL64pcrel32 @dummy3, csr_64, implicit $rsp, implicit-def $rsp
     73     CALL64pcrel32 @dummy3, csr_64, implicit $rsp, implicit-def $rsp
     74     JMP_1 %bb.2
     75 
     76   bb.4:
     77     RETQ
     78 
     79 ...
     80