• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -scalar-evolution -analyze -enable-new-pm=0 | FileCheck %s
3; RUN: opt < %s "-passes=print<scalar-evolution>" -disable-output 2>&1 | FileCheck %s
4
5target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-unknown-linux-gnu"
7
8define dso_local void @_Z4loopi(i32 %width) local_unnamed_addr #0 {
9; CHECK-LABEL: '_Z4loopi'
10; CHECK-NEXT:  Classifying expressions for: @_Z4loopi
11; CHECK-NEXT:    %storage = alloca [2 x i32], align 4
12; CHECK-NEXT:    --> %storage U: [0,-3) S: [-9223372036854775808,9223372036854775805)
13; CHECK-NEXT:    %0 = bitcast [2 x i32]* %storage to i8*
14; CHECK-NEXT:    --> %storage U: [0,-3) S: [-9223372036854775808,9223372036854775805)
15; CHECK-NEXT:    %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
16; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%for.cond> U: [0,-2147483648) S: [0,-2147483648) Exits: %width LoopDispositions: { %for.cond: Computable }
17; CHECK-NEXT:    %rem = srem i32 %i.0, 2
18; CHECK-NEXT:    --> (zext i1 {false,+,true}<%for.cond> to i32) U: [0,2) S: [0,2) Exits: (zext i1 (trunc i32 %width to i1) to i32) LoopDispositions: { %for.cond: Computable }
19; CHECK-NEXT:    %idxprom = sext i32 %rem to i64
20; CHECK-NEXT:    --> (zext i1 {false,+,true}<%for.cond> to i64) U: [0,2) S: [0,2) Exits: (zext i1 (trunc i32 %width to i1) to i64) LoopDispositions: { %for.cond: Computable }
21; CHECK-NEXT:    %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %storage, i64 0, i64 %idxprom
22; CHECK-NEXT:    --> ((4 * (zext i1 {false,+,true}<%for.cond> to i64))<nuw><nsw> + %storage)<nuw> U: [0,-3) S: [-9223372036854775808,9223372036854775805) Exits: ((4 * (zext i1 (trunc i32 %width to i1) to i64))<nuw><nsw> + %storage)<nuw> LoopDispositions: { %for.cond: Computable }
23; CHECK-NEXT:    %1 = load i32, i32* %arrayidx, align 4
24; CHECK-NEXT:    --> %1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.cond: Variant }
25; CHECK-NEXT:    %call = call i32 @_Z3adji(i32 %1)
26; CHECK-NEXT:    --> %call U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.cond: Variant }
27; CHECK-NEXT:    %2 = load i32, i32* %arrayidx, align 4
28; CHECK-NEXT:    --> %2 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.cond: Variant }
29; CHECK-NEXT:    %add = add nsw i32 %2, %call
30; CHECK-NEXT:    --> (%2 + %call) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.cond: Variant }
31; CHECK-NEXT:    %inc = add nsw i32 %i.0, 1
32; CHECK-NEXT:    --> {1,+,1}<nuw><%for.cond> U: [1,0) S: [1,0) Exits: (1 + %width) LoopDispositions: { %for.cond: Computable }
33; CHECK-NEXT:  Determining loop execution counts for: @_Z4loopi
34; CHECK-NEXT:  Loop %for.cond: backedge-taken count is %width
35; CHECK-NEXT:  Loop %for.cond: max backedge-taken count is -1
36; CHECK-NEXT:  Loop %for.cond: Predicated backedge-taken count is %width
37; CHECK-NEXT:   Predicates:
38; CHECK:       Loop %for.cond: Trip multiple is 1
39;
40entry:
41  %storage = alloca [2 x i32], align 4
42  %0 = bitcast [2 x i32]* %storage to i8*
43  call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #4
44  call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 0, i64 8, i1 false)
45  br label %for.cond
46
47for.cond:
48  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
49  %cmp = icmp ne i32 %i.0, %width
50  br i1 %cmp, label %for.body, label %for.cond.cleanup
51
52for.cond.cleanup:
53  call void @llvm.lifetime.end.p0i8(i64 8, i8* %0) #4
54  ret void
55
56for.body:
57  %rem = srem i32 %i.0, 2
58  %idxprom = sext i32 %rem to i64
59  %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %storage, i64 0, i64 %idxprom
60  %1 = load i32, i32* %arrayidx, align 4
61  %call = call i32 @_Z3adji(i32 %1)
62  %2 = load i32, i32* %arrayidx, align 4
63  %add = add nsw i32 %2, %call
64  store i32 %add, i32* %arrayidx, align 4
65  %inc = add nsw i32 %i.0, 1
66  br label %for.cond
67}
68
69declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
70
71declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #2
72
73declare dso_local i32 @_Z3adji(i32) local_unnamed_addr #3
74
75declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
76