Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt -S -indvars < %s | FileCheck %s
      2 
      3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
      4 target triple = "x86_64-apple-macosx10.10.0"
      5 
      6 @a = common global i32 0, align 4
      7 
      8 ; Function Attrs: nounwind ssp uwtable
      9 define void @fn1() {
     10 ; CHECK-LABEL: @fn1(
     11 bb:
     12   br label %bb4.preheader
     13 
     14 bb4.preheader:                                    ; preds = %bb, %bb16
     15 ; CHECK-LABEL:  bb4.preheader:
     16   %b.03 = phi i8 [ 0, %bb ], [ %tmp17, %bb16 ]
     17 ; CHECK: %tmp9 = icmp ugt i8 %b.03, 1
     18 ; CHECK-NOT: %tmp9 = icmp ugt i8 0, 1
     19 
     20   %tmp9 = icmp ugt i8 %b.03, 1
     21   br i1 %tmp9, label %bb4.preheader.bb18.loopexit.split_crit_edge, label %bb4.preheader.bb4.preheader.split_crit_edge
     22 
     23 bb4.preheader.bb4.preheader.split_crit_edge:      ; preds = %bb4.preheader
     24   br label %bb4.preheader.split
     25 
     26 bb4.preheader.bb18.loopexit.split_crit_edge:      ; preds = %bb4.preheader
     27   store i32 0, i32* @a, align 4
     28   br label %bb18.loopexit.split
     29 
     30 bb4.preheader.split:                              ; preds = %bb4.preheader.bb4.preheader.split_crit_edge
     31   br label %bb7
     32 
     33 bb4:                                              ; preds = %bb7
     34   %tmp6 = icmp slt i32 %storemerge2, 0
     35   br i1 %tmp6, label %bb7, label %bb16
     36 
     37 bb7:                                              ; preds = %bb4.preheader.split, %bb4
     38   %storemerge2 = phi i32 [ 0, %bb4.preheader.split ], [ %tmp14, %bb4 ]
     39   %tmp14 = add nsw i32 %storemerge2, 1
     40   br i1 false, label %bb18.loopexit, label %bb4
     41 
     42 bb16:                                             ; preds = %bb4
     43   %tmp14.lcssa5 = phi i32 [ %tmp14, %bb4 ]
     44   %tmp17 = add i8 %b.03, -1
     45   %tmp2 = icmp eq i8 %tmp17, -2
     46   br i1 %tmp2, label %bb18.loopexit1, label %bb4.preheader
     47 
     48 bb18.loopexit:                                    ; preds = %bb7
     49   br label %bb18.loopexit.split
     50 
     51 bb18.loopexit.split:                              ; preds = %bb4.preheader.bb18.loopexit.split_crit_edge, %bb18.loopexit
     52   br label %bb18
     53 
     54 bb18.loopexit1:                                   ; preds = %bb16
     55   %tmp14.lcssa5.lcssa = phi i32 [ %tmp14.lcssa5, %bb16 ]
     56   store i32 %tmp14.lcssa5.lcssa, i32* @a, align 4
     57   br label %bb18
     58 
     59 bb18:                                             ; preds = %bb18.loopexit1, %bb18.loopexit.split
     60   ret void
     61 }
     62 
     63 declare void @abort()
     64