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