Home | History | Annotate | Download | only in compactbranches
      1 ; RUN: llc -march=mips -mcpu=mips32r6 -O1 -start-after=dwarfehprepare < %s | FileCheck %s
      2 
      3 ; beqc/bnec have the constraint that $rs < $rt && $rs != 0 && $rt != 0
      4 ; Cases where $rs == 0 and $rt != 0 should be transformed into beqzc/bnezc.
      5 ; Cases where $rs > $rt can have the operands swapped as ==,!= are commutative.
      6 
      7 ; Cases where beq & bne where $rs == $rt have to inhibited from being turned
      8 ; into compact branches but arguably should not occur. This test covers the
      9 ; $rs == $rt case.
     10 
     11 ; Starting from dwarf exception handling preparation skips optimizations that
     12 ; may simplify out the crucical bnec $4, $4 instruction.
     13 
     14 define internal void @_ZL14TestRemoveLastv(i32* %alist.sroa.0.4) {
     15 entry:
     16   %ascevgep = getelementptr i32, i32* %alist.sroa.0.4, i64 99
     17   br label %do.body121
     18 
     19 for.cond117:
     20   %alsr.iv.next = add nsw i32 %alsr.iv, -1
     21   %ascevgep340 = getelementptr i32, i32* %alsr.iv339, i64 -1
     22   %acmp118 = icmp sgt i32 %alsr.iv.next, 0
     23   br i1 %acmp118, label %do.body121, label %if.then143
     24 
     25 do.body121:
     26   %alsr.iv339 = phi i32* [ %ascevgep, %entry ], [ %ascevgep340, %for.cond117 ]
     27   %alsr.iv = phi i32 [ 100, %entry ], [ %alsr.iv.next, %for.cond117 ]
     28   %a9 = add i32 %alsr.iv, -1
     29   %alnot124 = icmp eq i32 %alsr.iv, %alsr.iv
     30   br i1 %alnot124, label %do.body134, label %if.then143, !prof !11
     31 
     32 do.body134:
     33   %a10 = add i32 %alsr.iv, -1
     34   %a11 = load i32, i32* %alsr.iv339, align 4, !tbaa !5
     35 ; CHECK-NOT: bnec $[[R0:[0-9]+]], $[[R0]]
     36 ; CHECK-NOT: beqc $[[R1:[0-9]+]], $[[R1]]
     37   %alnot137 = icmp eq i32 %a9, %a11
     38   br i1 %alnot137, label %do.end146, label %if.then143, !prof !11
     39 
     40 if.then143:
     41  ret void
     42  unreachable
     43 
     44 do.end146:
     45   %alnot151 = icmp eq i32 %a9, %a10
     46   br i1 %alnot151, label %for.cond117, label %if.then143, !prof !11
     47 
     48 }
     49 !3 = !{!"omnipotent char", !4, i64 0}
     50 !4 = !{!"Simple C++ TBAA"}
     51 !5 = !{!6, !6, i64 0}
     52 !6 = !{!"int", !3, i64 0}
     53 !11 = !{!"branch_weights", i32 2000, i32 1}
     54 !12 = !{!"branch_weights", i32 -388717296, i32 7818360}
     55 
     56