Home | History | Annotate | Download | only in LoopVersioningLICM
      1 ; RUN: opt < %s  -O1  -S -loop-versioning-licm -debug-only=loop-versioning-licm  2>&1 | FileCheck %s
      2 ; REQUIRES: asserts
      3 ;
      4 ; Test to confirm loop is not a candidate for LoopVersioningLICM.
      5 ;
      6 ; CHECK: Loop: Loop at depth 2 containing: %for.body3<header><latch><exiting>
      7 ; CHECK-NEXT:    LAA: Runtime check not found !!
      8 ; CHECK-NEXT:    Loop instructions not suitable for LoopVersioningLICM
      9 
     10 define i32 @foo(i32* nocapture %var1, i32 %itr) #0 {
     11 entry:
     12   %cmp18 = icmp eq i32 %itr, 0
     13   br i1 %cmp18, label %for.end8, label %for.cond1.preheader
     14 
     15 for.cond1.preheader:                              ; preds = %entry, %for.inc6
     16   %j.020 = phi i32 [ %j.1.lcssa, %for.inc6 ], [ 0, %entry ]
     17   %i.019 = phi i32 [ %inc7, %for.inc6 ], [ 0, %entry ]
     18   %cmp216 = icmp ult i32 %j.020, %itr
     19   br i1 %cmp216, label %for.body3.lr.ph, label %for.inc6
     20 
     21 for.body3.lr.ph:                                  ; preds = %for.cond1.preheader
     22   %0 = zext i32 %j.020 to i64
     23   br label %for.body3
     24 
     25 for.body3:                                        ; preds = %for.body3, %for.body3.lr.ph
     26   %indvars.iv = phi i64 [ %0, %for.body3.lr.ph ], [ %indvars.iv.next, %for.body3 ]
     27   %arrayidx = getelementptr inbounds i32, i32* %var1, i64 %indvars.iv
     28   %1 = load i32, i32* %arrayidx, align 4
     29   %add = add nsw i32 %1, %itr
     30   store i32 %add, i32* %arrayidx, align 4
     31   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     32   %lftr.wideiv = trunc i64 %indvars.iv.next to i32
     33   %exitcond = icmp eq i32 %lftr.wideiv, %itr
     34   br i1 %exitcond, label %for.inc6, label %for.body3
     35 
     36 for.inc6:                                         ; preds = %for.body3, %for.cond1.preheader
     37   %j.1.lcssa = phi i32 [ %j.020, %for.cond1.preheader ], [ %itr, %for.body3 ]
     38   %inc7 = add nuw i32 %i.019, 1
     39   %exitcond21 = icmp eq i32 %inc7, %itr
     40   br i1 %exitcond21, label %for.end8, label %for.cond1.preheader
     41 
     42 for.end8:                                         ; preds = %for.inc6, %entry
     43   ret i32 0
     44 }
     45 
     46