120 changes: 60 additions & 60 deletions llvm/test/Analysis/ScalarEvolution/pr46786.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,128 +5,128 @@ source_filename = "input.cpp"
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"

; Function Attrs: nofree
define i8* @FSE_decompress_usingDTable(i8* %arg, i32 %arg1, i32 %arg2, i32 %arg3) local_unnamed_addr #0 {
define ptr @FSE_decompress_usingDTable(ptr %arg, i32 %arg1, i32 %arg2, i32 %arg3) local_unnamed_addr #0 {
; CHECK-LABEL: 'FSE_decompress_usingDTable'
; CHECK-NEXT: Classifying expressions for: @FSE_decompress_usingDTable
; CHECK-NEXT: %i = getelementptr inbounds i8, i8* %arg, i32 %arg2
; CHECK-NEXT: %i = getelementptr inbounds i8, ptr %arg, i32 %arg2
; CHECK-NEXT: --> (%arg2 + %arg) U: full-set S: full-set
; CHECK-NEXT: %i4 = sub nsw i32 0, %arg1
; CHECK-NEXT: --> (-1 * %arg1) U: full-set S: full-set
; CHECK-NEXT: %i5 = getelementptr inbounds i8, i8* %i, i32 %i4
; CHECK-NEXT: %i5 = getelementptr inbounds i8, ptr %i, i32 %i4
; CHECK-NEXT: --> ((-1 * %arg1) + %arg2 + %arg) U: full-set S: full-set
; CHECK-NEXT: %i7 = select i1 %i6, i32 %arg2, i32 %arg1
; CHECK-NEXT: --> ((-1 * (ptrtoint i8* %arg to i32)) + (((-1 * %arg1) + (ptrtoint i8* %arg to i32) + %arg2) umin (ptrtoint i8* %arg to i32)) + %arg1) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * (ptrtoint ptr %arg to i32)) + (((-1 * %arg1) + (ptrtoint ptr %arg to i32) + %arg2) umin (ptrtoint ptr %arg to i32)) + %arg1) U: full-set S: full-set
; CHECK-NEXT: %i8 = sub i32 %arg3, %i7
; CHECK-NEXT: --> ((-1 * (((-1 * %arg1) + (ptrtoint i8* %arg to i32) + %arg2) umin (ptrtoint i8* %arg to i32))) + (-1 * %arg1) + (ptrtoint i8* %arg to i32) + %arg3) U: full-set S: full-set
; CHECK-NEXT: %i9 = getelementptr inbounds i8, i8* %arg, i32 %i8
; CHECK-NEXT: --> ((-1 * (((-1 * %arg1) + (ptrtoint i8* %arg to i32) + %arg2) umin (ptrtoint i8* %arg to i32))) + (-1 * %arg1) + (ptrtoint i8* %arg to i32) + %arg3 + %arg) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * (((-1 * %arg1) + (ptrtoint ptr %arg to i32) + %arg2) umin (ptrtoint ptr %arg to i32))) + (-1 * %arg1) + (ptrtoint ptr %arg to i32) + %arg3) U: full-set S: full-set
; CHECK-NEXT: %i9 = getelementptr inbounds i8, ptr %arg, i32 %i8
; CHECK-NEXT: --> ((-1 * (((-1 * %arg1) + (ptrtoint ptr %arg to i32) + %arg2) umin (ptrtoint ptr %arg to i32))) + (-1 * %arg1) + (ptrtoint ptr %arg to i32) + %arg3 + %arg) U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @FSE_decompress_usingDTable
;
bb:
%i = getelementptr inbounds i8, i8* %arg, i32 %arg2
%i = getelementptr inbounds i8, ptr %arg, i32 %arg2
%i4 = sub nsw i32 0, %arg1
%i5 = getelementptr inbounds i8, i8* %i, i32 %i4
%i6 = icmp ult i8* %i5, %arg
%i5 = getelementptr inbounds i8, ptr %i, i32 %i4
%i6 = icmp ult ptr %i5, %arg
%i7 = select i1 %i6, i32 %arg2, i32 %arg1
%i8 = sub i32 %arg3, %i7
%i9 = getelementptr inbounds i8, i8* %arg, i32 %i8
ret i8* %i9
%i9 = getelementptr inbounds i8, ptr %arg, i32 %i8
ret ptr %i9
}

define i8* @test_01(i8* %p) {
define ptr @test_01(ptr %p) {
; CHECK-LABEL: 'test_01'
; CHECK-NEXT: Classifying expressions for: @test_01
; CHECK-NEXT: %p1 = getelementptr i8, i8* %p, i32 2
; CHECK-NEXT: %p1 = getelementptr i8, ptr %p, i32 2
; CHECK-NEXT: --> (2 + %p) U: full-set S: full-set
; CHECK-NEXT: %p2 = getelementptr i8, i8* %p, i32 1
; CHECK-NEXT: %p2 = getelementptr i8, ptr %p, i32 1
; CHECK-NEXT: --> (1 + %p) U: full-set S: full-set
; CHECK-NEXT: %index = select i1 %cmp, i32 2, i32 1
; CHECK-NEXT: --> ((-1 * (ptrtoint i8* %p to i32)) + ((1 + (ptrtoint i8* %p to i32)) umax (2 + (ptrtoint i8* %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * (ptrtoint ptr %p to i32)) + ((1 + (ptrtoint ptr %p to i32)) umax (2 + (ptrtoint ptr %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: %neg_index = sub i32 0, %index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) umax (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, i8* %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) umax (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) umax (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, ptr %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) umax (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @test_01
;
%p1 = getelementptr i8, i8* %p, i32 2
%p2 = getelementptr i8, i8* %p, i32 1
%cmp = icmp ugt i8* %p1, %p2
%p1 = getelementptr i8, ptr %p, i32 2
%p2 = getelementptr i8, ptr %p, i32 1
%cmp = icmp ugt ptr %p1, %p2
%index = select i1 %cmp, i32 2, i32 1
%neg_index = sub i32 0, %index
%gep = getelementptr i8, i8* %p, i32 %neg_index
ret i8* %gep
%gep = getelementptr i8, ptr %p, i32 %neg_index
ret ptr %gep
}

define i8* @test_02(i8* %p) {
define ptr @test_02(ptr %p) {
; CHECK-LABEL: 'test_02'
; CHECK-NEXT: Classifying expressions for: @test_02
; CHECK-NEXT: %p1 = getelementptr i8, i8* %p, i32 2
; CHECK-NEXT: %p1 = getelementptr i8, ptr %p, i32 2
; CHECK-NEXT: --> (2 + %p) U: full-set S: full-set
; CHECK-NEXT: %p2 = getelementptr i8, i8* %p, i32 1
; CHECK-NEXT: %p2 = getelementptr i8, ptr %p, i32 1
; CHECK-NEXT: --> (1 + %p) U: full-set S: full-set
; CHECK-NEXT: %index = select i1 %cmp, i32 2, i32 1
; CHECK-NEXT: --> ((-1 * (ptrtoint i8* %p to i32)) + ((1 + (ptrtoint i8* %p to i32)) smax (2 + (ptrtoint i8* %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * (ptrtoint ptr %p to i32)) + ((1 + (ptrtoint ptr %p to i32)) smax (2 + (ptrtoint ptr %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: %neg_index = sub i32 0, %index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) smax (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, i8* %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) smax (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) smax (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, ptr %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) smax (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @test_02
;
%p1 = getelementptr i8, i8* %p, i32 2
%p2 = getelementptr i8, i8* %p, i32 1
%cmp = icmp sgt i8* %p1, %p2
%p1 = getelementptr i8, ptr %p, i32 2
%p2 = getelementptr i8, ptr %p, i32 1
%cmp = icmp sgt ptr %p1, %p2
%index = select i1 %cmp, i32 2, i32 1
%neg_index = sub i32 0, %index
%gep = getelementptr i8, i8* %p, i32 %neg_index
ret i8* %gep
%gep = getelementptr i8, ptr %p, i32 %neg_index
ret ptr %gep
}

define i8* @test_03(i8* %p) {
define ptr @test_03(ptr %p) {
; CHECK-LABEL: 'test_03'
; CHECK-NEXT: Classifying expressions for: @test_03
; CHECK-NEXT: %p1 = getelementptr i8, i8* %p, i32 2
; CHECK-NEXT: %p1 = getelementptr i8, ptr %p, i32 2
; CHECK-NEXT: --> (2 + %p) U: full-set S: full-set
; CHECK-NEXT: %p2 = getelementptr i8, i8* %p, i32 1
; CHECK-NEXT: %p2 = getelementptr i8, ptr %p, i32 1
; CHECK-NEXT: --> (1 + %p) U: full-set S: full-set
; CHECK-NEXT: %index = select i1 %cmp, i32 2, i32 1
; CHECK-NEXT: --> ((-1 * (ptrtoint i8* %p to i32)) + ((1 + (ptrtoint i8* %p to i32)) umin (2 + (ptrtoint i8* %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * (ptrtoint ptr %p to i32)) + ((1 + (ptrtoint ptr %p to i32)) umin (2 + (ptrtoint ptr %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: %neg_index = sub i32 0, %index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) umin (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, i8* %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) umin (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) umin (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, ptr %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) umin (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @test_03
;
%p1 = getelementptr i8, i8* %p, i32 2
%p2 = getelementptr i8, i8* %p, i32 1
%cmp = icmp ult i8* %p1, %p2
%p1 = getelementptr i8, ptr %p, i32 2
%p2 = getelementptr i8, ptr %p, i32 1
%cmp = icmp ult ptr %p1, %p2
%index = select i1 %cmp, i32 2, i32 1
%neg_index = sub i32 0, %index
%gep = getelementptr i8, i8* %p, i32 %neg_index
ret i8* %gep
%gep = getelementptr i8, ptr %p, i32 %neg_index
ret ptr %gep
}

define i8* @test_04(i8* %p) {
define ptr @test_04(ptr %p) {
; CHECK-LABEL: 'test_04'
; CHECK-NEXT: Classifying expressions for: @test_04
; CHECK-NEXT: %p1 = getelementptr i8, i8* %p, i32 2
; CHECK-NEXT: %p1 = getelementptr i8, ptr %p, i32 2
; CHECK-NEXT: --> (2 + %p) U: full-set S: full-set
; CHECK-NEXT: %p2 = getelementptr i8, i8* %p, i32 1
; CHECK-NEXT: %p2 = getelementptr i8, ptr %p, i32 1
; CHECK-NEXT: --> (1 + %p) U: full-set S: full-set
; CHECK-NEXT: %index = select i1 %cmp, i32 2, i32 1
; CHECK-NEXT: --> ((-1 * (ptrtoint i8* %p to i32)) + ((1 + (ptrtoint i8* %p to i32)) smin (2 + (ptrtoint i8* %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * (ptrtoint ptr %p to i32)) + ((1 + (ptrtoint ptr %p to i32)) smin (2 + (ptrtoint ptr %p to i32)))) U: full-set S: full-set
; CHECK-NEXT: %neg_index = sub i32 0, %index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) smin (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, i8* %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint i8* %p to i32)) smin (2 + (ptrtoint i8* %p to i32)))) + (ptrtoint i8* %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) smin (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32)) U: full-set S: full-set
; CHECK-NEXT: %gep = getelementptr i8, ptr %p, i32 %neg_index
; CHECK-NEXT: --> ((-1 * ((1 + (ptrtoint ptr %p to i32)) smin (2 + (ptrtoint ptr %p to i32)))) + (ptrtoint ptr %p to i32) + %p) U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @test_04
;
%p1 = getelementptr i8, i8* %p, i32 2
%p2 = getelementptr i8, i8* %p, i32 1
%cmp = icmp slt i8* %p1, %p2
%p1 = getelementptr i8, ptr %p, i32 2
%p2 = getelementptr i8, ptr %p, i32 1
%cmp = icmp slt ptr %p1, %p2
%index = select i1 %cmp, i32 2, i32 1
%neg_index = sub i32 0, %index
%gep = getelementptr i8, i8* %p, i32 %neg_index
ret i8* %gep
%gep = getelementptr i8, ptr %p, i32 %neg_index
ret ptr %gep
}

attributes #0 = { nofree }
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
@v_228 = external dso_local global i32, align 1

; Function Attrs: nounwind
define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5, i16* %6, i16* %7, i16* %8, i16* %9, i16* %10, i1 %11) #0 {
define dso_local i16 @main(ptr %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr %5, ptr %6, ptr %7, ptr %8, ptr %9, ptr %10, i1 %11) #0 {
br i1 %11, label %27, label %13

13: ; preds = %12
%14 = load i32, i32* @v_228, align 1
%14 = load i32, ptr @v_228, align 1
%15 = trunc i32 %14 to i16
%16 = mul i16 %15, 2
%17 = sub i16 10, %16
Expand All @@ -36,7 +36,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %26, label %139, label %27

27: ; preds = %21, %12
%28 = load i16, i16* %1, align 1
%28 = load i16, ptr %1, align 1
br label %29

29: ; preds = %29, %27
Expand All @@ -46,7 +46,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %32, label %29, label %33

33: ; preds = %29
%34 = load i16, i16* %2, align 1
%34 = load i16, ptr %2, align 1
br label %35

35: ; preds = %43, %33
Expand All @@ -65,7 +65,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %45, label %35, label %46

46: ; preds = %43
%47 = load i16, i16* %3, align 1
%47 = load i16, ptr %3, align 1
br label %48

48: ; preds = %55, %46
Expand All @@ -83,7 +83,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %57, label %48, label %58

58: ; preds = %55
%59 = load i16, i16* %4, align 1
%59 = load i16, ptr %4, align 1
br label %60

60: ; preds = %67, %58
Expand All @@ -101,7 +101,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %69, label %60, label %70

70: ; preds = %67
%71 = load i16, i16* %5, align 1
%71 = load i16, ptr %5, align 1
br label %72

72: ; preds = %79, %70
Expand All @@ -119,7 +119,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %81, label %72, label %82

82: ; preds = %79
%83 = load i16, i16* %6, align 1
%83 = load i16, ptr %6, align 1
br label %84

84: ; preds = %91, %82
Expand All @@ -137,7 +137,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %93, label %84, label %94

94: ; preds = %91
%95 = load i16, i16* %7, align 1
%95 = load i16, ptr %7, align 1
br label %96

96: ; preds = %103, %94
Expand All @@ -155,7 +155,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %105, label %96, label %106

106: ; preds = %103
%107 = load i16, i16* %8, align 1
%107 = load i16, ptr %8, align 1
br label %108

108: ; preds = %115, %106
Expand All @@ -173,7 +173,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %117, label %108, label %118

118: ; preds = %115
%119 = load i16, i16* %9, align 1
%119 = load i16, ptr %9, align 1
br label %120

120: ; preds = %128, %118
Expand All @@ -192,7 +192,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %130, label %120, label %131

131: ; preds = %128
%132 = load i16, i16* %10, align 1
%132 = load i16, ptr %10, align 1
br label %133

133: ; preds = %133, %131
Expand All @@ -202,7 +202,7 @@ define dso_local i16 @main(i16* %0, i16* %1, i16* %2, i16* %3, i16* %4, i16* %5,
br i1 %136, label %133, label %137

137: ; preds = %133
%138 = load i16, i16* %0, align 1
%138 = load i16, ptr %0, align 1
ret i16 %138

139: ; preds = %120, %108, %96, %84, %72, %60, %48, %35, %21, %13
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @test1(i32 %N, i32 %M) {
; CHECK-LABEL: 'test1'
; CHECK-NEXT: Classifying expressions for: @test1
; CHECK-NEXT: %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i16 %i.0
; CHECK-NEXT: %tmp = getelementptr [1000 x i32], ptr @A, i32 0, i16 %i.0
; CHECK-NEXT: --> ((4 * (sext i16 {0,+,1}<%bb3> to i64))<nsw> + @A) U: [0,-3) S: [-9223372036854775808,9223372036854775805) Exits: <<Unknown>> LoopDispositions: { %bb3: Computable }
; CHECK-NEXT: %tmp2 = add i16 %i.0, 1
; CHECK-NEXT: --> {1,+,1}<%bb3> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb3: Computable }
Expand All @@ -41,8 +41,8 @@ entry:
br label %bb3

bb: ; preds = %bb3
%tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i16 %i.0 ; <i32*> [#uses=1]
store i32 123, i32* %tmp
%tmp = getelementptr [1000 x i32], ptr @A, i32 0, i16 %i.0 ; <ptr> [#uses=1]
store i32 123, ptr %tmp
%tmp2 = add i16 %i.0, 1 ; <i32> [#uses=1]
br label %bb3

Expand Down Expand Up @@ -88,7 +88,7 @@ return: ; preds = %bb5
define void @test2(i32 %N, i32 %M, i16 %Start) {
; CHECK-LABEL: 'test2'
; CHECK-NEXT: Classifying expressions for: @test2
; CHECK-NEXT: %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i16 %i.0
; CHECK-NEXT: %tmp = getelementptr [1000 x i32], ptr @A, i32 0, i16 %i.0
; CHECK-NEXT: --> ((4 * (sext i16 {%Start,+,-1}<%bb3> to i64))<nsw> + @A) U: [0,-3) S: [-9223372036854775808,9223372036854775805) Exits: <<Unknown>> LoopDispositions: { %bb3: Computable }
; CHECK-NEXT: %tmp2 = sub i16 %i.0, 1
; CHECK-NEXT: --> {(-1 + %Start),+,-1}<%bb3> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb3: Computable }
Expand All @@ -108,8 +108,8 @@ entry:
br label %bb3

bb: ; preds = %bb3
%tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i16 %i.0 ; <i32*> [#uses=1]
store i32 123, i32* %tmp
%tmp = getelementptr [1000 x i32], ptr @A, i32 0, i16 %i.0 ; <ptr> [#uses=1]
store i32 123, ptr %tmp
%tmp2 = sub i16 %i.0, 1 ; <i32> [#uses=1]
br label %bb3

Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Analysis/ScalarEvolution/range-signedness.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s

define void @x(i1* %cond) {
define void @x(ptr %cond) {
; CHECK-LABEL: Classifying expressions for: @x
entry:
br label %loop
Expand All @@ -12,14 +12,14 @@ define void @x(i1* %cond) {

%idx.inc = add nsw i8 %idx, 1

%c = load volatile i1, i1* %cond
%c = load volatile i1, ptr %cond
br i1 %c, label %loop, label %exit

exit:
ret void
}

define void @y(i8* %addr) {
define void @y(ptr %addr) {
; CHECK-LABEL: Classifying expressions for: @y
entry:
br label %loop
Expand Down
48 changes: 24 additions & 24 deletions llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; RUN: opt < %s -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s

; copied from flags-from-poison.ll
define void @test-add-nuw(float* %input, i32 %offset, i32 %numIterations) {
define void @test-add-nuw(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: 'test-add-nuw'
; CHECK-NEXT: Classifying expressions for: @test-add-nuw
; CHECK-NEXT: %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
Expand All @@ -11,7 +11,7 @@ define void @test-add-nuw(float* %input, i32 %offset, i32 %numIterations) {
; CHECK-NEXT: --> {1,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: %numIterations LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %index32 = add nuw i32 %nexti, %offset
; CHECK-NEXT: --> {(1 + %offset)<nuw>,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: (%offset + %numIterations) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %ptr = getelementptr inbounds float, float* %input, i32 %index32
; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32
; CHECK-NEXT: --> ((4 * (sext i32 {(1 + %offset)<nuw>,+,1}<nuw><%loop> to i64))<nsw> + %input) U: full-set S: full-set Exits: ((4 * (sext i32 (%offset + %numIterations) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @test-add-nuw
; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)
Expand All @@ -27,16 +27,16 @@ loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nuw i32 %i, 1
%index32 = add nuw i32 %nexti, %offset
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%ptr = getelementptr inbounds float, ptr %input, i32 %index32
%f = load float, ptr %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop

exit:
ret void
}

define void @test-addrec-nuw(float* %input, i32 %offset, i32 %numIterations) {
define void @test-addrec-nuw(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: 'test-addrec-nuw'
; CHECK-NEXT: Classifying expressions for: @test-addrec-nuw
; CHECK-NEXT: %min.10 = select i1 %cmp, i32 %offset, i32 10
Expand All @@ -47,7 +47,7 @@ define void @test-addrec-nuw(float* %input, i32 %offset, i32 %numIterations) {
; CHECK-NEXT: --> {1,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: %numIterations LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %index32 = add nuw i32 %nexti, %min.10
; CHECK-NEXT: --> {(1 + (10 smax %offset))<nuw>,+,1}<nuw><%loop> U: [11,0) S: [11,0) Exits: ((10 smax %offset) + %numIterations) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %ptr = getelementptr inbounds float, float* %input, i32 %index32
; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32
; CHECK-NEXT: --> ((4 * (sext i32 {(1 + (10 smax %offset))<nuw>,+,1}<nuw><%loop> to i64))<nsw> + %input) U: full-set S: full-set Exits: ((4 * (sext i32 ((10 smax %offset) + %numIterations) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nuw
; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)
Expand All @@ -65,16 +65,16 @@ loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nuw i32 %i, 1
%index32 = add nuw i32 %nexti, %min.10
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%ptr = getelementptr inbounds float, ptr %input, i32 %index32
%f = load float, ptr %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop

exit:
ret void
}

define void @test-addrec-nsw-start-neg-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
define void @test-addrec-nsw-start-neg-strip-neg(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: 'test-addrec-nsw-start-neg-strip-neg'
; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-neg-strip-neg
; CHECK-NEXT: %max = select i1 %cmp, i32 %offset, i32 -10
Expand All @@ -85,7 +85,7 @@ define void @test-addrec-nsw-start-neg-strip-neg(float* %input, i32 %offset, i32
; CHECK-NEXT: --> {-1,+,-1}<nsw><%loop> U: [-2147483648,0) S: [-2147483648,0) Exits: %numIterations LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %index32 = add nsw i32 %nexti, %max
; CHECK-NEXT: --> {(-1 + (-10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,-10) S: [-2147483648,-10) Exits: ((-10 smin %offset) + %numIterations) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %ptr = getelementptr inbounds float, float* %input, i32 %index32
; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32
; CHECK-NEXT: --> {(-4 + (4 * (sext i32 (-10 smin %offset) to i64))<nsw> + %input),+,-4}<nw><%loop> U: full-set S: full-set Exits: (-4 + (4 * (sext i32 (-10 smin %offset) to i64))<nsw> + (-4 * (zext i32 (-1 + (-1 * %numIterations)) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-neg-strip-neg
; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %numIterations))
Expand All @@ -103,16 +103,16 @@ loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, -1
%index32 = add nsw i32 %nexti, %max
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%ptr = getelementptr inbounds float, ptr %input, i32 %index32
%f = load float, ptr %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop

exit:
ret void
}

define void @test-addrec-nsw-start-pos-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
define void @test-addrec-nsw-start-pos-strip-neg(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: 'test-addrec-nsw-start-pos-strip-neg'
; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-pos-strip-neg
; CHECK-NEXT: %max = select i1 %cmp, i32 %offset, i32 10
Expand All @@ -123,7 +123,7 @@ define void @test-addrec-nsw-start-pos-strip-neg(float* %input, i32 %offset, i32
; CHECK-NEXT: --> {-1,+,-1}<nsw><%loop> U: [-2147483648,0) S: [-2147483648,0) Exits: %numIterations LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %index32 = add nsw i32 %nexti, %max
; CHECK-NEXT: --> {(-1 + (10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,10) S: [-2147483648,10) Exits: ((10 smin %offset) + %numIterations) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %ptr = getelementptr inbounds float, float* %input, i32 %index32
; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32
; CHECK-NEXT: --> {(-4 + (4 * (sext i32 (10 smin %offset) to i64))<nsw> + %input),+,-4}<nw><%loop> U: full-set S: full-set Exits: (-4 + (4 * (sext i32 (10 smin %offset) to i64))<nsw> + (-4 * (zext i32 (-1 + (-1 * %numIterations)) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-pos-strip-neg
; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %numIterations))
Expand All @@ -141,16 +141,16 @@ loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, -1
%index32 = add nsw i32 %nexti, %max
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%ptr = getelementptr inbounds float, ptr %input, i32 %index32
%f = load float, ptr %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop

exit:
ret void
}

define void @test-addrec-nsw-start-pos-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
define void @test-addrec-nsw-start-pos-strip-pos(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: 'test-addrec-nsw-start-pos-strip-pos'
; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-pos-strip-pos
; CHECK-NEXT: %min = select i1 %cmp, i32 %offset, i32 10
Expand All @@ -161,7 +161,7 @@ define void @test-addrec-nsw-start-pos-strip-pos(float* %input, i32 %offset, i32
; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: %numIterations LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %index32 = add nsw i32 %nexti, %min
; CHECK-NEXT: --> {(1 + (10 smax %offset))<nuw><nsw>,+,1}<nuw><nsw><%loop> U: [11,-2147483648) S: [11,-2147483648) Exits: ((10 smax %offset) + %numIterations) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %ptr = getelementptr inbounds float, float* %input, i32 %index32
; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32
; CHECK-NEXT: --> {(4 + (4 * (zext i32 (10 smax %offset) to i64))<nuw><nsw> + %input)<nuw>,+,4}<nuw><%loop> U: [44,0) S: [44,0) Exits: (4 + (4 * (zext i32 (-1 + %numIterations) to i64))<nuw><nsw> + (4 * (zext i32 (10 smax %offset) to i64))<nuw><nsw> + %input) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-pos-strip-pos
; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)
Expand All @@ -179,16 +179,16 @@ loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, 1
%index32 = add nsw i32 %nexti, %min
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%ptr = getelementptr inbounds float, ptr %input, i32 %index32
%f = load float, ptr %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop

exit:
ret void
}

define void @test-addrec-nsw-start-neg-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
define void @test-addrec-nsw-start-neg-strip-pos(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: 'test-addrec-nsw-start-neg-strip-pos'
; CHECK-NEXT: Classifying expressions for: @test-addrec-nsw-start-neg-strip-pos
; CHECK-NEXT: %min = select i1 %cmp, i32 %offset, i32 -10
Expand All @@ -199,7 +199,7 @@ define void @test-addrec-nsw-start-neg-strip-pos(float* %input, i32 %offset, i32
; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%loop> U: [1,-2147483648) S: [1,-2147483648) Exits: %numIterations LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %index32 = add nsw i32 %nexti, %min
; CHECK-NEXT: --> {(1 + (-10 smax %offset))<nsw>,+,1}<nsw><%loop> U: [-9,-2147483648) S: [-9,-2147483648) Exits: ((-10 smax %offset) + %numIterations) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %ptr = getelementptr inbounds float, float* %input, i32 %index32
; CHECK-NEXT: %ptr = getelementptr inbounds float, ptr %input, i32 %index32
; CHECK-NEXT: --> {(4 + (4 * (sext i32 (-10 smax %offset) to i64))<nsw> + %input),+,4}<nw><%loop> U: full-set S: full-set Exits: (4 + (4 * (zext i32 (-1 + %numIterations) to i64))<nuw><nsw> + (4 * (sext i32 (-10 smax %offset) to i64))<nsw> + %input) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: Determining loop execution counts for: @test-addrec-nsw-start-neg-strip-pos
; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %numIterations)
Expand All @@ -217,8 +217,8 @@ loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, 1
%index32 = add nsw i32 %nexti, %min
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%ptr = getelementptr inbounds float, ptr %input, i32 %index32
%f = load float, ptr %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop

Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Analysis/ScalarEvolution/ranges.ll
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ define i32 @ashr(i32 %a) {
define i64 @ashr_global() {
; CHECK-LABEL: 'ashr_global'
; CHECK-NEXT: Classifying expressions for: @ashr_global
; CHECK-NEXT: %ashr = ashr i64 ptrtoint (i8* @G to i64), 63
; CHECK-NEXT: %ashr = ashr i64 ptrtoint (ptr @G to i64), 63
; CHECK-NEXT: --> %ashr U: [-1,1) S: [-1,1)
; CHECK-NEXT: Determining loop execution counts for: @ashr_global
;
%ashr = ashr i64 ptrtoint (i8* @G to i64), 63
%pos = icmp sge i8* @G, null
%ashr = ashr i64 ptrtoint (ptr @G to i64), 63
%pos = icmp sge ptr @G, null
call void @llvm.assume(i1 %pos)
ret i64 %ashr
}
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Analysis/ScalarEvolution/returned.ll
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
; RUN: opt < %s -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"

define i8* @foo(i32 %no, i8* nocapture %d) nounwind {
define ptr @foo(i32 %no, ptr nocapture %d) nounwind {
entry:
%v = call i8* @func1(i8* %d)
%w = getelementptr i8, i8* %v, i64 5
ret i8* %w
%v = call ptr @func1(ptr %d)
%w = getelementptr i8, ptr %v, i64 5
ret ptr %w
}

; CHECK-LABEL: Classifying expressions for: @foo
; CHECK: %w = getelementptr i8, i8* %v, i64 5
; CHECK: %w = getelementptr i8, ptr %v, i64 5
; CHECK-NEXT: (5 + %d)

declare i8* @func1(i8* returned) nounwind argmemonly
declare ptr @func1(ptr returned) nounwind argmemonly

10 changes: 5 additions & 5 deletions llvm/test/Analysis/ScalarEvolution/scalable-vector.ll
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt "-passes=print<scalar-evolution>" -disable-output < %s 2>&1 | FileCheck %s

define void @a(<vscale x 1 x i64> *%p) {
define void @a(ptr %p) {
; CHECK-LABEL: 'a'
; CHECK-NEXT: Classifying expressions for: @a
; CHECK-NEXT: %1 = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* null, i32 3
; CHECK-NEXT: %1 = getelementptr <vscale x 4 x i32>, ptr null, i32 3
; CHECK-NEXT: --> ((3 * sizeof(<vscale x 4 x i32>)) + null) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
; CHECK-NEXT: %2 = getelementptr <vscale x 1 x i64>, <vscale x 1 x i64>* %p, i32 1
; CHECK-NEXT: %2 = getelementptr <vscale x 1 x i64>, ptr %p, i32 1
; CHECK-NEXT: --> (sizeof(<vscale x 1 x i64>) + %p) U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @a
;
getelementptr <vscale x 4 x i32>, <vscale x 4 x i32> *null, i32 3
getelementptr <vscale x 1 x i64>, <vscale x 1 x i64> *%p, i32 1
getelementptr <vscale x 4 x i32>, ptr null, i32 3
getelementptr <vscale x 1 x i64>, ptr %p, i32 1
ret void
}
8 changes: 4 additions & 4 deletions llvm/test/Analysis/ScalarEvolution/scev-dispositions.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s

define void @single_loop(i32* %buf, i32 %start) {
define void @single_loop(ptr %buf, i32 %start) {
; CHECK-LABEL: Classifying expressions for: @single_loop
entry:
%val = add i32 %start, 400
Expand All @@ -18,23 +18,23 @@ define void @single_loop(i32* %buf, i32 %start) {
; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Invariant }
; CHECK: %idx.inc = add nsw i32 %idx, 1
; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Computable }
; CHECK: %val3 = load volatile i32, i32* %buf
; CHECK: %val3 = load volatile i32, ptr %buf
; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Variant }

%val2 = add i32 %start, 400
%idx.inc = add nsw i32 %idx, 1
%idx.inc.sext = sext i32 %idx.inc to i64
%condition = icmp eq i32 %counter, 1
%counter.inc = add i32 %counter, 1
%val3 = load volatile i32, i32* %buf
%val3 = load volatile i32, ptr %buf
br i1 %condition, label %exit, label %loop

exit:
ret void
}


define void @nested_loop(double* %p, i64 %m) {
define void @nested_loop(ptr %p, i64 %m) {
; CHECK-LABEL: Classifying expressions for: @nested_loop

; CHECK: %j = phi i64 [ 0, %entry ], [ %j.next, %outer.latch ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
; CHECK: select
; CHECK-NOT: select

@ySrcL = common global i8* null, align 8
@ySrcL = common global ptr null, align 8
@smL = common global i32 0, align 4

define void @foo(i32 %rwL, i32 %kL, i32 %xfL) {
Expand All @@ -17,16 +17,16 @@ entry:
br i1 %cmp6, label %for.body.lr.ph, label %for.end

for.body.lr.ph: ; preds = %entry
%tmp = load i8*, i8** @ySrcL, align 8
%tmp = load ptr, ptr @ySrcL, align 8
%tmp1 = sext i32 %kL to i64
%tmp2 = sext i32 %cond.i to i64
br label %for.body

for.body: ; preds = %for.body, %for.body.lr.ph
%indvars.iv = phi i64 [ %tmp1, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%reduct.07 = phi i32 [ 0, %for.body.lr.ph ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i8, i8* %tmp, i64 %indvars.iv
%tmp3 = load i8, i8* %arrayidx, align 1
%arrayidx = getelementptr inbounds i8, ptr %tmp, i64 %indvars.iv
%tmp3 = load i8, ptr %arrayidx, align 1
%conv = zext i8 %tmp3 to i32
%add = add nsw i32 %conv, %reduct.07
%indvars.iv.next = add nsw i64 %indvars.iv, 1
Expand All @@ -39,6 +39,6 @@ for.end.loopexit: ; preds = %for.body

for.end: ; preds = %for.end.loopexit, %entry
%reduct.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa, %for.end.loopexit ]
store i32 %reduct.0.lcssa, i32* @smL, align 4
store i32 %reduct.0.lcssa, ptr @smL, align 4
ret void
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ for.body.lr.ph: ; preds = %entry
for.body: ; preds = %for.body, %for.body.lr.ph
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%total.011 = phi i32 [ 0, %for.body.lr.ph ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds [1000 x i16], [1000 x i16]* @a, i64 0, i64 %indvars.iv
%tmp1 = load i16, i16* %arrayidx, align 2
%arrayidx = getelementptr inbounds [1000 x i16], ptr @a, i64 0, i64 %indvars.iv
%tmp1 = load i16, ptr %arrayidx, align 2
%conv = sext i16 %tmp1 to i32
%add = add nsw i32 %conv, %total.011
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Analysis/ScalarEvolution/scev-prestart-nowrap.ll
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define i64 @bad.0(i32 %start, i32 %low.limit, i32 %high.limit) {
ret i64 %postinc.sext
}

define i64 @bad.1(i32 %start, i32 %low.limit, i32 %high.limit, i1* %unknown) {
define i64 @bad.1(i32 %start, i32 %low.limit, i32 %high.limit, ptr %unknown) {
; CHECK-LABEL: Classifying expressions for: @bad.1
entry:
%postinc.start = add i32 %start, 1
Expand All @@ -66,7 +66,7 @@ define i64 @bad.1(i32 %start, i32 %low.limit, i32 %high.limit, i1* %unknown) {
br i1 %break.early, label %continue.1, label %early.exit

continue.1:
%cond = load volatile i1, i1* %unknown
%cond = load volatile i1, ptr %unknown
%idx.inc = add nsw i32 %idx, 1
br i1 %cond, label %loop, label %continue

Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Analysis/ScalarEvolution/sext-inreg.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9.6"

define i64 @foo(i64* nocapture %x, i64 %n) nounwind {
define i64 @foo(ptr nocapture %x, i64 %n) nounwind {
; CHECK-LABEL: Classifying expressions for: @foo
entry:
%t0 = icmp sgt i64 %n, 0
Expand All @@ -21,8 +21,8 @@ bb:
; CHECK-SAME: Exits: (sext i59 (-199 + (trunc i64 %n to i59)) to i64)
%s1 = shl i64 %i.01, 5
%s2 = ashr i64 %s1, 5
%t3 = getelementptr i64, i64* %x, i64 %i.01
store i64 0, i64* %t3, align 1
%t3 = getelementptr i64, ptr %x, i64 %i.01
store i64 0, ptr %t3, align 1
%indvar.next = add i64 %i.01, 199
%exitcond = icmp eq i64 %indvar.next, %n
br i1 %exitcond, label %return, label %bb
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Analysis/ScalarEvolution/sext-iv-0.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"

define void @foo(double* nocapture %x) nounwind {
define void @foo(ptr nocapture %x) nounwind {
bb1.thread:
br label %bb1

Expand All @@ -23,12 +23,12 @@ bb1: ; preds = %bb1, %bb1.thread
%2 = sext i9 %1 to i64 ; <i64> [#uses=1]
; CHECK: %2
; CHECK-NEXT: --> {-128,+,1}<nsw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127
%3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1]
%4 = load double, double* %3, align 8 ; <double> [#uses=1]
%3 = getelementptr double, ptr %x, i64 %2 ; <ptr> [#uses=1]
%4 = load double, ptr %3, align 8 ; <double> [#uses=1]
%5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1]
%6 = sext i8 %0 to i64 ; <i64> [#uses=1]
%7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1]
store double %5, double* %7, align 8
%7 = getelementptr double, ptr %x, i64 %6 ; <ptr> [#uses=1]
store double %5, ptr %7, align 8
%8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2]
%9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1]
br i1 %9, label %return, label %bb1
Expand Down
40 changes: 20 additions & 20 deletions llvm/test/Analysis/ScalarEvolution/sext-iv-1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"

define void @foo0(double* nocapture %x) nounwind {
define void @foo0(ptr nocapture %x) nounwind {
bb1.thread:
br label %bb1

Expand All @@ -22,12 +22,12 @@ bb1: ; preds = %bb1, %bb1.thread
%0 = trunc i64 %i.0.reg2mem.0 to i7 ; <i8> [#uses=1]
%1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1]
%2 = sext i9 %1 to i64 ; <i64> [#uses=1]
%3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1]
%4 = load double, double* %3, align 8 ; <double> [#uses=1]
%3 = getelementptr double, ptr %x, i64 %2 ; <ptr> [#uses=1]
%4 = load double, ptr %3, align 8 ; <double> [#uses=1]
%5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1]
%6 = sext i7 %0 to i64 ; <i64> [#uses=1]
%7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1]
store double %5, double* %7, align 8
%7 = getelementptr double, ptr %x, i64 %6 ; <ptr> [#uses=1]
store double %5, ptr %7, align 8
%8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2]
%9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1]
br i1 %9, label %return, label %bb1
Expand All @@ -36,7 +36,7 @@ return: ; preds = %bb1
ret void
}

define void @foo1(double* nocapture %x) nounwind {
define void @foo1(ptr nocapture %x) nounwind {
bb1.thread:
br label %bb1

Expand All @@ -45,12 +45,12 @@ bb1: ; preds = %bb1, %bb1.thread
%0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1]
%1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1]
%2 = sext i9 %1 to i64 ; <i64> [#uses=1]
%3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1]
%4 = load double, double* %3, align 8 ; <double> [#uses=1]
%3 = getelementptr double, ptr %x, i64 %2 ; <ptr> [#uses=1]
%4 = load double, ptr %3, align 8 ; <double> [#uses=1]
%5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1]
%6 = sext i8 %0 to i64 ; <i64> [#uses=1]
%7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1]
store double %5, double* %7, align 8
%7 = getelementptr double, ptr %x, i64 %6 ; <ptr> [#uses=1]
store double %5, ptr %7, align 8
%8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2]
%9 = icmp sgt i64 %8, 128 ; <i1> [#uses=1]
br i1 %9, label %return, label %bb1
Expand All @@ -59,7 +59,7 @@ return: ; preds = %bb1
ret void
}

define void @foo2(double* nocapture %x) nounwind {
define void @foo2(ptr nocapture %x) nounwind {
bb1.thread:
br label %bb1

Expand All @@ -68,12 +68,12 @@ bb1: ; preds = %bb1, %bb1.thread
%0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1]
%1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1]
%2 = sext i9 %1 to i64 ; <i64> [#uses=1]
%3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1]
%4 = load double, double* %3, align 8 ; <double> [#uses=1]
%3 = getelementptr double, ptr %x, i64 %2 ; <ptr> [#uses=1]
%4 = load double, ptr %3, align 8 ; <double> [#uses=1]
%5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1]
%6 = sext i8 %0 to i64 ; <i64> [#uses=1]
%7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1]
store double %5, double* %7, align 8
%7 = getelementptr double, ptr %x, i64 %6 ; <ptr> [#uses=1]
store double %5, ptr %7, align 8
%8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2]
%9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1]
br i1 %9, label %return, label %bb1
Expand All @@ -82,7 +82,7 @@ return: ; preds = %bb1
ret void
}

define void @foo3(double* nocapture %x) nounwind {
define void @foo3(ptr nocapture %x) nounwind {
bb1.thread:
br label %bb1

Expand All @@ -91,12 +91,12 @@ bb1: ; preds = %bb1, %bb1.thread
%0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1]
%1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1]
%2 = sext i9 %1 to i64 ; <i64> [#uses=1]
%3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1]
%4 = load double, double* %3, align 8 ; <double> [#uses=1]
%3 = getelementptr double, ptr %x, i64 %2 ; <ptr> [#uses=1]
%4 = load double, ptr %3, align 8 ; <double> [#uses=1]
%5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1]
%6 = sext i8 %0 to i64 ; <i64> [#uses=1]
%7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1]
store double %5, double* %7, align 8
%7 = getelementptr double, ptr %x, i64 %6 ; <ptr> [#uses=1]
store double %5, ptr %7, align 8
%8 = add i64 %i.0.reg2mem.0, -1 ; <i64> [#uses=2]
%9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1]
br i1 %9, label %return, label %bb1
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Analysis/ScalarEvolution/sext-iv-2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64"

@table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <[32 x [256 x i32]]*> [#uses=2]
@table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <ptr> [#uses=2]

define i32 @main() nounwind {
entry:
Expand All @@ -32,8 +32,8 @@ bb1: ; preds = %bb2, %bb.nph
%tmp4 = mul i32 %tmp3, %i.02 ; <i32> [#uses=1]
%tmp5 = sext i32 %i.02 to i64 ; <i64> [#uses=1]
%tmp6 = sext i32 %j.01 to i64 ; <i64> [#uses=1]
%tmp7 = getelementptr [32 x [256 x i32]], [32 x [256 x i32]]* @table, i64 0, i64 %tmp5, i64 %tmp6 ; <i32*> [#uses=1]
store i32 %tmp4, i32* %tmp7, align 4
%tmp7 = getelementptr [32 x [256 x i32]], ptr @table, i64 0, i64 %tmp5, i64 %tmp6 ; <ptr> [#uses=1]
store i32 %tmp4, ptr %tmp7, align 4
%tmp8 = add i32 %j.01, 1 ; <i32> [#uses=2]
br label %bb2

Expand All @@ -56,7 +56,7 @@ bb4.bb5_crit_edge: ; preds = %bb4
br label %bb5

bb5: ; preds = %bb4.bb5_crit_edge, %entry
%tmp12 = load i32, i32* getelementptr ([32 x [256 x i32]], [32 x [256 x i32]]* @table, i64 0, i64 9, i64 132), align 16 ; <i32> [#uses=1]
%tmp12 = load i32, ptr getelementptr ([32 x [256 x i32]], ptr @table, i64 0, i64 9, i64 132), align 16 ; <i32> [#uses=1]
%tmp13 = icmp eq i32 %tmp12, -1116 ; <i1> [#uses=1]
br i1 %tmp13, label %bb7, label %bb6

Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Analysis/ScalarEvolution/sext-zero.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; CHECK-NEXT: %tmp10 = ashr exact i64 %tmp9, 0
; CHECK-NEXT: --> {{.*}} Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64)))

define void @foo(i32* nocapture %arg, i32 %arg1, i32 %arg2) {
define void @foo(ptr nocapture %arg, i32 %arg1, i32 %arg2) {
bb:
%tmp = icmp sgt i32 %arg2, 0
br i1 %tmp, label %bb3, label %bb6
Expand All @@ -24,15 +24,15 @@ bb7: ; preds = %bb7, %bb3
%tmp8 = phi i64 [ %tmp18, %bb7 ], [ 0, %bb3 ]
%tmp9 = shl i64 %tmp8, 33
%tmp10 = ashr exact i64 %tmp9, 0
%tmp11 = getelementptr inbounds i32, i32* %arg, i64 %tmp10
%tmp12 = load i32, i32* %tmp11, align 4
%tmp11 = getelementptr inbounds i32, ptr %arg, i64 %tmp10
%tmp12 = load i32, ptr %tmp11, align 4
%tmp13 = sub nsw i32 %tmp12, %arg1
store i32 %tmp13, i32* %tmp11, align 4
store i32 %tmp13, ptr %tmp11, align 4
%tmp14 = or i64 %tmp10, 1
%tmp15 = getelementptr inbounds i32, i32* %arg, i64 %tmp14
%tmp16 = load i32, i32* %tmp15, align 4
%tmp15 = getelementptr inbounds i32, ptr %arg, i64 %tmp14
%tmp16 = load i32, ptr %tmp15, align 4
%tmp17 = mul nsw i32 %tmp16, %arg1
store i32 %tmp17, i32* %tmp15, align 4
store i32 %tmp17, ptr %tmp15, align 4
%tmp18 = add nuw nsw i64 %tmp8, 1
%tmp19 = icmp eq i64 %tmp18, %tmp4
br i1 %tmp19, label %bb5, label %bb7
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Analysis/ScalarEvolution/shift-op.ll
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ define void @test2(i32 %init) {
ret void
}

define void @test3(i32* %init.ptr) {
define void @test3(ptr %init.ptr) {
; CHECK-LABEL: Determining loop execution counts for: @test3
; CHECK: Loop %loop: constant max backedge-taken count is 32
entry:
%init = load i32, i32* %init.ptr, !range !0
%init = load i32, ptr %init.ptr, !range !0
br label %loop

loop:
Expand All @@ -68,11 +68,11 @@ define void @test3(i32* %init.ptr) {
ret void
}

define void @test4(i32* %init.ptr) {
define void @test4(ptr %init.ptr) {
; CHECK-LABEL: Classifying expressions for: @test4
; CHECK-LABEL: Loop %loop: constant max backedge-taken count is 32
entry:
%init = load i32, i32* %init.ptr, !range !1
%init = load i32, ptr %init.ptr, !range !1
br label %loop

loop:
Expand All @@ -85,13 +85,13 @@ define void @test4(i32* %init.ptr) {
ret void
}

define void @test5(i32* %init.ptr) {
define void @test5(ptr %init.ptr) {
; CHECK-LABEL: Determining loop execution counts for: @test5
; CHECK: Loop %loop: Unpredictable constant max backedge-taken count.

; %iv will "stabilize" to -1, so this is an infinite loop
entry:
%init = load i32, i32* %init.ptr, !range !1
%init = load i32, ptr %init.ptr, !range !1
br label %loop

loop:
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Analysis/ScalarEvolution/sle.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
; CHECK: Loop %for.body: backedge-taken count is %n
; CHECK: Loop %for.body: constant max backedge-taken count is 9223372036854775807

define void @le(i64 %n, double* nocapture %p) nounwind {
define void @le(i64 %n, ptr nocapture %p) nounwind {
entry:
%cmp6 = icmp slt i64 %n, 0 ; <i1> [#uses=1]
br i1 %cmp6, label %for.end, label %for.body

for.body: ; preds = %for.body, %entry
%i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] ; <i64> [#uses=2]
%arrayidx = getelementptr double, double* %p, i64 %i ; <double*> [#uses=2]
%t4 = load double, double* %arrayidx ; <double> [#uses=1]
%arrayidx = getelementptr double, ptr %p, i64 %i ; <ptr> [#uses=2]
%t4 = load double, ptr %arrayidx ; <double> [#uses=1]
%mul = fmul double %t4, 2.200000e+00 ; <double> [#uses=1]
store double %mul, double* %arrayidx
store double %mul, ptr %arrayidx
%i.next = add nsw i64 %i, 1 ; <i64> [#uses=2]
%cmp = icmp sgt i64 %i.next, %n ; <i1> [#uses=1]
br i1 %cmp, label %for.end, label %for.body
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Analysis/ScalarEvolution/smax-br-phi-idioms.ll
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ define i32 @f1(i32 %x, i32 %y) {
ret i32 %v
}

define i32 @f2(i32 %x, i32 %y, i32* %ptr) {
define i32 @f2(i32 %x, i32 %y, ptr %ptr) {
; CHECK-LABEL: Classifying expressions for: @f2
entry:
%c = icmp sge i32 %y, 0
br i1 %c, label %add, label %merge

add:
%lv = load i32, i32* %ptr
%lv = load i32, ptr %ptr
br label %merge

merge:
Expand Down Expand Up @@ -103,7 +103,7 @@ define i32 @f4(i32 %x, i32 %init, i32 %lim) {
ret i32 %v
}

define i32 @f5(i32* %val) {
define i32 @f5(ptr %val) {
; CHECK-LABEL: Classifying expressions for: @f5
entry:
br label %for.end
Expand All @@ -112,7 +112,7 @@ for.condt:
br i1 true, label %for.cond.0, label %for.end

for.end:
%inc = load i32, i32* %val
%inc = load i32, ptr %val
br i1 false, label %for.condt, label %for.cond.0

for.cond.0:
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Analysis/ScalarEvolution/solve-quadratic-i1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ b2: ; preds = %b1

@g0 = common dso_local global i16 0, align 2
@g1 = common dso_local global i32 0, align 4
@g2 = common dso_local global i32* null, align 8
@g2 = common dso_local global ptr null, align 8

define void @f1() #0 {
; CHECK-LABEL: 'f1'
Expand Down Expand Up @@ -76,8 +76,8 @@ define void @f1() #0 {
; CHECK: Loop %b1: Trip multiple is 3
;
b0:
store i16 0, i16* @g0, align 2
store i32* @g1, i32** @g2, align 8
store i16 0, ptr @g0, align 2
store ptr @g1, ptr @g2, align 8
br label %b1

b1: ; preds = %b1, %b0
Expand All @@ -93,8 +93,8 @@ b1: ; preds = %b1, %b0
b2: ; preds = %b1
%v7 = phi i32 [ %v1, %b1 ]
%v8 = phi i16 [ %v3, %b1 ]
store i32 %v7, i32* @g1, align 4
store i16 %v8, i16* @g0, align 2
store i32 %v7, ptr @g1, align 4
store i16 %v8, ptr @g0, align 2
br label %b3

b3: ; preds = %b3, %b2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ b2: ; preds = %b1
%v5 = phi i16 [ %v2, %b1 ]
%v6 = phi i16 [ %v3, %b1 ]
%v7 = sext i16 %v5 to i32
store i32 %v7, i32* @g0, align 4
store i16 %v6, i16* @g1, align 2
store i32 %v7, ptr @g0, align 4
store i16 %v6, ptr @g1, align 2
ret i32 0
}

9 changes: 4 additions & 5 deletions llvm/test/Analysis/ScalarEvolution/strip-injective-zext.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64"

define i32 @f0(i32 %a0, i32 %a1, i32* nocapture %a2) #0 {
define i32 @f0(i32 %a0, i32 %a1, ptr nocapture %a2) #0 {
b0:
%v0 = and i32 %a1, 3
%v1 = icmp eq i32 %v0, 0
Expand All @@ -26,10 +26,9 @@ b1: ; preds = %b0

b2: ; preds = %b2, %b1
%v4 = phi i32 [ %a1, %b1 ], [ %v9, %b2 ]
%v5 = phi i32* [ %a2, %b1 ], [ %v8, %b2 ]
%v6 = getelementptr inbounds i32, i32* %v5, i32 0
store i32 %v3, i32* %v6, align 4
%v8 = getelementptr inbounds i32, i32* %v5, i32 1
%v5 = phi ptr [ %a2, %b1 ], [ %v8, %b2 ]
store i32 %v3, ptr %v5, align 4
%v8 = getelementptr inbounds i32, ptr %v5, i32 1
%v9 = add nsw i32 %v4, 1
%v10 = and i32 %v9, 3
%v11 = icmp eq i32 %v10, 0
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ entry:

for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
store volatile i8 %iv, i8* @G
store volatile i8 %iv, ptr @G
%iv.next = add i8 %iv, 1
%zext = zext i8 %iv to i16
%cmp = icmp ult i16 %zext, 257
Expand Down Expand Up @@ -145,7 +145,7 @@ entry:
for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
%iv.next = add i8 %iv, 1
store i8 %iv, i8* @G
store i8 %iv, ptr @G
%zext = zext i8 %iv.next to i16
%cmp = icmp ult i16 %zext, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -170,7 +170,7 @@ entry:
for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
%iv.next = add i8 %iv, 3
store i8 %iv, i8* @G
store i8 %iv, ptr @G
%zext = zext i8 %iv.next to i16
%cmp = icmp ult i16 %zext, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -197,7 +197,7 @@ entry:
for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
%iv.next = add i8 %iv, %step
store i8 %iv, i8* @G
store i8 %iv, ptr @G
%zext = zext i8 %iv.next to i16
%cmp = icmp ult i16 %zext, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -222,7 +222,7 @@ entry:
for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
%iv.next = add i8 %iv, %step
store i8 %iv, i8* @G
store i8 %iv, ptr @G
%zext = zext i8 %iv.next to i16
%cmp = icmp ult i16 %zext, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -249,7 +249,7 @@ entry:
for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
%iv.next = add i8 %iv, 2
store i8 %iv, i8* @G
store i8 %iv, ptr @G
%zext = zext i8 %iv.next to i16
%cmp = icmp ult i16 %zext, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -276,7 +276,7 @@ entry:
for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
%iv.next = add i8 %iv, 1
store i8 %iv, i8* @G
store i8 %iv, ptr @G
%zext = zext i8 %iv.next to i16
%cmp = icmp ult i16 %zext, %n
br i1 %cmp, label %for.body, label %for.end
Expand Down Expand Up @@ -304,7 +304,7 @@ entry:
for.body: ; preds = %entry, %for.body
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
%iv.next = add i8 %iv, 1
store i8 %iv, i8* @G
store i8 %iv, ptr @G
%zext = zext i8 %iv.next to i16
%cmp = icmp ult i16 %zext, %n
br i1 %cmp, label %for.body, label %for.end
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/Analysis/ScalarEvolution/trip-count-negative-stride.ll
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ for.end: ; preds = %for.body, %entry
ret void
}

define void @ult_129_varying_rhs(i8* %n_p) {
define void @ult_129_varying_rhs(ptr %n_p) {
; CHECK-LABEL: 'ult_129_varying_rhs'
; CHECK-NEXT: Determining loop execution counts for: @ult_129_varying_rhs
; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
Expand All @@ -267,15 +267,15 @@ entry:
for.body: ; preds = %entry, %for.body
%i.05 = phi i8 [ %add, %for.body ], [ 0, %entry ]
%add = add nuw i8 %i.05, 129
%n = load i8, i8* %n_p
%n = load i8, ptr %n_p
%cmp = icmp ult i8 %add, %n
br i1 %cmp, label %for.body, label %for.end

for.end: ; preds = %for.body, %entry
ret void
}

define void @ult_symbolic_varying_rhs(i8* %n_p, i8 %step) {
define void @ult_symbolic_varying_rhs(ptr %n_p, i8 %step) {
; CHECK-LABEL: 'ult_symbolic_varying_rhs'
; CHECK-NEXT: Determining loop execution counts for: @ult_symbolic_varying_rhs
; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
Expand All @@ -291,7 +291,7 @@ entry:
for.body: ; preds = %entry, %for.body
%i.05 = phi i8 [ %add, %for.body ], [ 0, %entry ]
%add = add nuw i8 %i.05, %step
%n = load i8, i8* %n_p
%n = load i8, ptr %n_p
%cmp = icmp ult i8 %add, %n
br i1 %cmp, label %for.body, label %for.end

Expand Down Expand Up @@ -549,7 +549,7 @@ for.end: ; preds = %for.body, %entry
ret void
}

define void @slt_129_varying_rhs(i8* %n_p) {
define void @slt_129_varying_rhs(ptr %n_p) {
; CHECK-LABEL: 'slt_129_varying_rhs'
; CHECK-NEXT: Determining loop execution counts for: @slt_129_varying_rhs
; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
Expand All @@ -563,15 +563,15 @@ entry:
for.body: ; preds = %entry, %for.body
%i.05 = phi i8 [ %add, %for.body ], [ -128, %entry ]
%add = add nsw i8 %i.05, 129
%n = load i8, i8* %n_p
%n = load i8, ptr %n_p
%cmp = icmp slt i8 %add, %n
br i1 %cmp, label %for.body, label %for.end

for.end: ; preds = %for.body, %entry
ret void
}

define void @slt_symbolic_varying_rhs(i8* %n_p, i8 %step) {
define void @slt_symbolic_varying_rhs(ptr %n_p, i8 %step) {
; CHECK-LABEL: 'slt_symbolic_varying_rhs'
; CHECK-NEXT: Determining loop execution counts for: @slt_symbolic_varying_rhs
; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
Expand All @@ -587,7 +587,7 @@ entry:
for.body: ; preds = %entry, %for.body
%i.05 = phi i8 [ %add, %for.body ], [ -128, %entry ]
%add = add nsw i8 %i.05, %step
%n = load i8, i8* %n_p
%n = load i8, ptr %n_p
%cmp = icmp slt i8 %add, %n
br i1 %cmp, label %for.body, label %for.end

Expand Down
74 changes: 37 additions & 37 deletions llvm/test/Analysis/ScalarEvolution/trip-count-unknown-stride.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"

define void @foo1(i32* nocapture %A, i32 %n, i32 %s) mustprogress {
define void @foo1(ptr nocapture %A, i32 %n, i32 %s) mustprogress {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body, label %for.end

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, %s
%cmp = icmp slt i32 %add, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -40,16 +40,16 @@ for.end: ; preds = %for.body, %entry
; loops with unknown stride.
; CHECK: constant max backedge-taken count is -1

define void @foo2(i32* nocapture %A, i32 %n, i32 %s) mustprogress {
define void @foo2(ptr nocapture %A, i32 %n, i32 %s) mustprogress {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, %s
%cmp = icmp slt i32 %add, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -64,16 +64,16 @@ for.end: ; preds = %for.body, %entry
; CHECK: Loop %for.body: Unpredictable backedge-taken count.
; CHECK: Loop %for.body: Unpredictable constant max backedge-taken count.

define void @foo3(i32* nocapture %A, i32 %n, i32 %s) {
define void @foo3(ptr nocapture %A, i32 %n, i32 %s) {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, %s
%cmp = icmp slt i32 %add, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -87,16 +87,16 @@ for.end: ; preds = %for.body, %entry
; CHECK: backedge-taken count is ((((-1 * (1 umin ((-1 * %s) + (%n smax %s))))<nuw><nsw> + (-1 * %s) + (%n smax %s)) /u (1 umax %s)) + (1 umin ((-1 * %s) + (%n smax %s))))
; CHECK: constant max backedge-taken count is -1

define void @foo4(i32* nocapture %A, i32 %n, i32 %s) {
define void @foo4(ptr nocapture %A, i32 %n, i32 %s) {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, %s
%cmp = icmp slt i32 %add, %n
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8
Expand All @@ -113,16 +113,16 @@ for.end: ; preds = %for.body, %entry
; loops with unknown stride.
; CHECK: constant max backedge-taken count is -1

define void @foo5(i32* nocapture %A, i32 %n, i32 %s, i32 %start) mustprogress {
define void @foo5(ptr nocapture %A, i32 %n, i32 %s, i32 %start) mustprogress {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ %start, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, %s
%cmp = icmp slt i32 %i.05, %n
br i1 %cmp, label %for.body, label %for.end
Expand All @@ -138,16 +138,16 @@ for.end: ; preds = %for.body, %entry
; CHECK: Loop %for.body: Unpredictable constant max backedge-taken count.
; CHECK: Loop %for.body: Unpredictable predicated backedge-taken count.
; Note that this function is well defined only when %n <=s 0
define void @zero_stride(i32* nocapture %A, i32 %n) {
define void @zero_stride(ptr nocapture %A, i32 %n) {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, 0
%cmp = icmp slt i32 %add, %n
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8
Expand All @@ -162,16 +162,16 @@ for.end: ; preds = %for.body, %entry
; CHECK: Loop %for.body: Unpredictable predicated backedge-taken count.
; Note that this function will always execute undefined behavior and thus
; any value is valid for a backedge taken count.
define void @zero_stride_ub(i32* nocapture %A) {
define void @zero_stride_ub(ptr nocapture %A) {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, 0
%cmp = icmp slt i32 %add, 2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8
Expand All @@ -185,16 +185,16 @@ for.end: ; preds = %for.body, %entry
; CHECK: Loop %for.body: backedge-taken count is ((((-1 * (1 umin ((-1 * %zero) + (%n smax %zero))))<nuw><nsw> + (-1 * %zero) + (%n smax %zero)) /u (1 umax %zero)) + (1 umin ((-1 * %zero) + (%n smax %zero))))
; CHECK: Loop %for.body: constant max backedge-taken count is -1

define void @zero_stride_symbolic(i32* nocapture %A, i32 %n, i32 %zero) {
define void @zero_stride_symbolic(ptr nocapture %A, i32 %n, i32 %zero) {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, %zero
%cmp = icmp slt i32 %add, %n
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8
Expand All @@ -208,18 +208,18 @@ for.end: ; preds = %for.body, %entry
; CHECK: Loop %for.body: Unpredictable backedge-taken count.
; CHECK: Loop %for.body: Unpredictable constant max backedge-taken count

define void @zero_stride_varying_rhs(i32* nocapture %A, i32* %n_p, i32 %zero) {
define void @zero_stride_varying_rhs(ptr nocapture %A, ptr %n_p, i32 %zero) {
entry:
br label %for.body

for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.05
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %i.05
%0 = load i32, ptr %arrayidx, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* %arrayidx, align 4
store i32 %inc, ptr %arrayidx, align 4
%add = add nsw i32 %i.05, %zero
%n = load i32, i32* %n_p
%n = load i32, ptr %n_p
%cmp = icmp slt i32 %add, %n
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8

Expand Down
25 changes: 12 additions & 13 deletions llvm/test/Analysis/ScalarEvolution/trip-count.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ entry:
br label %bb3

bb: ; preds = %bb3
%tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
store i32 123, i32* %tmp
%tmp = getelementptr [1000 x i32], ptr @A, i32 0, i32 %i.0 ; <ptr> [#uses=1]
store i32 123, ptr %tmp
%tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1]
br label %bb3

Expand Down Expand Up @@ -49,8 +49,7 @@ define i32 @PR22795() {
;
entry:
%bins = alloca [16 x i64], align 16
%0 = bitcast [16 x i64]* %bins to i8*
call void @llvm.memset.p0i8.i64(i8* align 16 %0, i8 0, i64 128, i1 false)
call void @llvm.memset.p0.i64(ptr align 16 %bins, i8 0, i64 128, i1 false)
br label %preheader

preheader: ; preds = %for.inc.1, %entry
Expand All @@ -61,11 +60,11 @@ preheader: ; preds = %for.inc.1, %entry

for.body: ; preds = %preheader
%zext = zext i32 %iv to i64
%arrayidx = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 %v11
%loaded = load i64, i64* %arrayidx, align 8
%arrayidx = getelementptr [16 x i64], ptr %bins, i64 0, i64 %v11
%loaded = load i64, ptr %arrayidx, align 8
%add = add i64 %loaded, 1
%add2 = add i64 %add, %zext
store i64 %add2, i64* %arrayidx, align 8
store i64 %add2, ptr %arrayidx, align 8
br label %for.inc

for.inc: ; preds = %for.body, %preheader
Expand All @@ -74,19 +73,19 @@ for.inc: ; preds = %for.body, %preheade
br i1 true, label %for.body.1, label %for.inc.1

end: ; preds = %for.inc.1
%arrayidx8 = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 2
%load = load i64, i64* %arrayidx8, align 16
%arrayidx8 = getelementptr [16 x i64], ptr %bins, i64 0, i64 2
%load = load i64, ptr %arrayidx8, align 16
%shr4 = lshr i64 %load, 32
%conv = trunc i64 %shr4 to i32
ret i32 %conv

for.body.1: ; preds = %for.inc
%zext.1 = zext i32 %next to i64
%arrayidx.1 = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 %next12
%loaded.1 = load i64, i64* %arrayidx.1, align 8
%arrayidx.1 = getelementptr [16 x i64], ptr %bins, i64 0, i64 %next12
%loaded.1 = load i64, ptr %arrayidx.1, align 8
%add.1 = add i64 %loaded.1, 1
%add2.1 = add i64 %add.1, %zext.1
store i64 %add2.1, i64* %arrayidx.1, align 8
store i64 %add2.1, ptr %arrayidx.1, align 8
br label %for.inc.1

for.inc.1: ; preds = %for.body.1, %for.inc
Expand All @@ -97,7 +96,7 @@ for.inc.1: ; preds = %for.body.1, %for.in
}

; Function Attrs: nounwind
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) #0
declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) #0

declare void @may_exit() nounwind

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Analysis/ScalarEvolution/trip-count10.ll
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ return:
; One side of the expression test against a value that will be skipped.
; We can't assume undefined behavior just because we have an NSW flag.
;
define void @exit_orcond_nsw(i32 *%a) nounwind {
define void @exit_orcond_nsw(ptr %a) nounwind {
; CHECK-LABEL: 'exit_orcond_nsw'
; CHECK-NEXT: Determining loop execution counts for: @exit_orcond_nsw
; CHECK-NEXT: Loop %for.body.i: Unpredictable backedge-taken count.
Expand All @@ -175,6 +175,6 @@ for.body.i: ; preds = %for.body.i, %entry

exit: ; preds = %for.body.i
%b.01.i.lcssa = phi i32 [ %b.01.i, %for.body.i ]
store i32 %b.01.i.lcssa, i32* %a, align 4
store i32 %b.01.i.lcssa, ptr %a, align 4
ret void
}
8 changes: 4 additions & 4 deletions llvm/test/Analysis/ScalarEvolution/trip-count11.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ for.cond: ; preds = %for.inc, %entry

for.inc: ; preds = %for.cond
%idxprom = sext i32 %i.0 to i64
%arrayidx = getelementptr inbounds [8 x i32], [8 x i32]* @foo.a, i64 0, i64 %idxprom
%0 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds [8 x i32], ptr @foo.a, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4
%add = add nsw i32 %sum.0, %0
%inc = add nsw i32 %i.0, 1
br label %for.cond
Expand All @@ -43,8 +43,8 @@ for.cond: ; preds = %for.inc, %entry

for.inc: ; preds = %for.cond
%idxprom = sext i32 %i.0 to i64
%arrayidx = getelementptr inbounds [8 x i32], [8 x i32] addrspace(1)* @foo.a_as1, i64 0, i64 %idxprom
%0 = load i32, i32 addrspace(1)* %arrayidx, align 4
%arrayidx = getelementptr inbounds [8 x i32], ptr addrspace(1) @foo.a_as1, i64 0, i64 %idxprom
%0 = load i32, ptr addrspace(1) %arrayidx, align 4
%add = add nsw i32 %sum.0, %0
%inc = add nsw i32 %i.0, 1
br label %for.cond
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Analysis/ScalarEvolution/trip-count12.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len) /u 2)
; CHECK: Loop %for.body: constant max backedge-taken count is 1073741823

define zeroext i16 @test(i16* nocapture %p, i32 %len) nounwind readonly {
define zeroext i16 @test(ptr nocapture %p, i32 %len) nounwind readonly {
entry:
%cmp2 = icmp sgt i32 %len, 1
br i1 %cmp2, label %for.body.preheader, label %for.end
Expand All @@ -13,11 +13,11 @@ for.body.preheader: ; preds = %entry
br label %for.body

for.body: ; preds = %for.body, %for.body.preheader
%p.addr.05 = phi i16* [ %incdec.ptr, %for.body ], [ %p, %for.body.preheader ]
%p.addr.05 = phi ptr [ %incdec.ptr, %for.body ], [ %p, %for.body.preheader ]
%len.addr.04 = phi i32 [ %sub, %for.body ], [ %len, %for.body.preheader ]
%res.03 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
%incdec.ptr = getelementptr inbounds i16, i16* %p.addr.05, i32 1
%0 = load i16, i16* %p.addr.05, align 2
%incdec.ptr = getelementptr inbounds i16, ptr %p.addr.05, i32 1
%0 = load i16, ptr %p.addr.05, align 2
%conv = zext i16 %0 to i32
%add = add i32 %conv, %res.03
%sub = add nsw i32 %len.addr.04, -2
Expand Down
48 changes: 24 additions & 24 deletions llvm/test/Analysis/ScalarEvolution/trip-count14.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt -S -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 < %s 2>&1 | FileCheck %s

define void @s32_max1(i32 %n, i32* %p) {
define void @s32_max1(i32 %n, ptr %p) {
; CHECK-LABEL: 's32_max1'
; CHECK-NEXT: Determining loop execution counts for: @s32_max1
; CHECK-NEXT: Loop %do.body: backedge-taken count is ((-1 * %n) + ((1 + %n) smax %n))
Expand All @@ -17,8 +17,8 @@ entry:

do.body:
%i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp = icmp slt i32 %i.0, %add
br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 1 times
Expand All @@ -27,7 +27,7 @@ do.end:
ret void
}

define void @s32_max2(i32 %n, i32* %p) {
define void @s32_max2(i32 %n, ptr %p) {
; CHECK-LABEL: 's32_max2'
; CHECK-NEXT: Determining loop execution counts for: @s32_max2
; CHECK-NEXT: Loop %do.body: backedge-taken count is ((-1 * %n) + ((2 + %n) smax %n))
Expand All @@ -43,8 +43,8 @@ entry:

do.body:
%i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp = icmp slt i32 %i.0, %add
br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 2 times
Expand All @@ -53,7 +53,7 @@ do.end:
ret void
}

define void @s32_maxx(i32 %n, i32 %x, i32* %p) {
define void @s32_maxx(i32 %n, i32 %x, ptr %p) {
; CHECK-LABEL: 's32_maxx'
; CHECK-NEXT: Determining loop execution counts for: @s32_maxx
; CHECK-NEXT: Loop %do.body: backedge-taken count is ((-1 * %n) + ((%n + %x) smax %n))
Expand All @@ -69,8 +69,8 @@ entry:

do.body:
%i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp = icmp slt i32 %i.0, %add
br i1 %cmp, label %do.body, label %do.end ; taken either 0 or x times
Expand All @@ -79,7 +79,7 @@ do.end:
ret void
}

define void @s32_max2_unpredictable_exit(i32 %n, i32 %x, i32* %p) {
define void @s32_max2_unpredictable_exit(i32 %n, i32 %x, ptr %p) {
; CHECK-LABEL: 's32_max2_unpredictable_exit'
; CHECK-NEXT: Determining loop execution counts for: @s32_max2_unpredictable_exit
; CHECK-NEXT: Loop %do.body: <multiple exits> backedge-taken count is (((-1 * %n) + ((2 + %n) smax %n)) umin ((-1 * %n) + %x))
Expand All @@ -103,8 +103,8 @@ do.body:
br i1 %cmp, label %do.end, label %if.end ; unpredictable

if.end:
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp1 = icmp slt i32 %i.0, %add
br i1 %cmp1, label %do.body, label %do.end ; taken either 0 or 2 times
Expand All @@ -113,7 +113,7 @@ do.end:
ret void
}

define void @u32_max1(i32 %n, i32* %p) {
define void @u32_max1(i32 %n, ptr %p) {
; CHECK-LABEL: 'u32_max1'
; CHECK-NEXT: Determining loop execution counts for: @u32_max1
; CHECK-NEXT: Loop %do.body: backedge-taken count is ((-1 * %n) + ((1 + %n) umax %n))
Expand All @@ -129,8 +129,8 @@ entry:

do.body:
%i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp = icmp ult i32 %i.0, %add
br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 1 times
Expand All @@ -139,7 +139,7 @@ do.end:
ret void
}

define void @u32_max2(i32 %n, i32* %p) {
define void @u32_max2(i32 %n, ptr %p) {
; CHECK-LABEL: 'u32_max2'
; CHECK-NEXT: Determining loop execution counts for: @u32_max2
; CHECK-NEXT: Loop %do.body: backedge-taken count is ((-1 * %n) + ((2 + %n) umax %n))
Expand All @@ -155,8 +155,8 @@ entry:

do.body:
%i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp = icmp ult i32 %i.0, %add
br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 2 times
Expand All @@ -165,7 +165,7 @@ do.end:
ret void
}

define void @u32_maxx(i32 %n, i32 %x, i32* %p) {
define void @u32_maxx(i32 %n, i32 %x, ptr %p) {
; CHECK-LABEL: 'u32_maxx'
; CHECK-NEXT: Determining loop execution counts for: @u32_maxx
; CHECK-NEXT: Loop %do.body: backedge-taken count is ((-1 * %n) + ((%n + %x) umax %n))
Expand All @@ -181,8 +181,8 @@ entry:

do.body:
%i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp = icmp ult i32 %i.0, %add
br i1 %cmp, label %do.body, label %do.end ; taken either 0 or x times
Expand All @@ -191,7 +191,7 @@ do.end:
ret void
}

define void @u32_max2_unpredictable_exit(i32 %n, i32 %x, i32* %p) {
define void @u32_max2_unpredictable_exit(i32 %n, i32 %x, ptr %p) {
; CHECK-LABEL: 'u32_max2_unpredictable_exit'
; CHECK-NEXT: Determining loop execution counts for: @u32_max2_unpredictable_exit
; CHECK-NEXT: Loop %do.body: <multiple exits> backedge-taken count is (((-1 * %n) + ((2 + %n) umax %n)) umin ((-1 * %n) + %x))
Expand All @@ -215,8 +215,8 @@ do.body:
br i1 %cmp, label %do.end, label %if.end ; unpredictable

if.end:
%arrayidx = getelementptr i32, i32* %p, i32 %i.0
store i32 %i.0, i32* %arrayidx, align 4
%arrayidx = getelementptr i32, ptr %p, i32 %i.0
store i32 %i.0, ptr %arrayidx, align 4
%inc = add i32 %i.0, 1
%cmp1 = icmp ult i32 %i.0, %add
br i1 %cmp1, label %do.body, label %do.end ; taken either 0 or 2 times
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Analysis/ScalarEvolution/trip-count2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ entry:
br label %bb3

bb: ; preds = %bb3
%tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
store i32 123, i32* %tmp
%tmp = getelementptr [1000 x i32], ptr @A, i32 0, i32 %i.0 ; <ptr> [#uses=1]
store i32 123, ptr %tmp
%tmp4 = mul i32 %i.0, 4 ; <i32> [#uses=1]
%tmp5 = or i32 %tmp4, 1
%tmp61 = xor i32 %tmp5, -2147483648
Expand Down
64 changes: 31 additions & 33 deletions llvm/test/Analysis/ScalarEvolution/trip-count3.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,38 @@
; dividing by the stride will have a remainder. This could theoretically
; be teaching it how to use a more elaborate trip count computation.

%struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
%struct.FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
%struct.SHA_INFO = type { [5 x i32], i32, i32, [16 x i32] }
%struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
%struct._IO_marker = type { ptr, ptr, i32 }

@_2E_str = external constant [26 x i8]
@stdin = external global %struct.FILE*
@stdin = external global ptr
@_2E_str1 = external constant [3 x i8]
@_2E_str12 = external constant [30 x i8]

declare void @sha_init(%struct.SHA_INFO* nocapture) nounwind
declare void @sha_init(ptr nocapture) nounwind

declare fastcc void @sha_transform(%struct.SHA_INFO* nocapture) nounwind
declare fastcc void @sha_transform(ptr nocapture) nounwind

declare void @sha_print(%struct.SHA_INFO* nocapture) nounwind
declare void @sha_print(ptr nocapture) nounwind

declare i32 @printf(i8* nocapture, ...) nounwind
declare i32 @printf(ptr nocapture, ...) nounwind

declare void @sha_final(%struct.SHA_INFO* nocapture) nounwind
declare void @sha_final(ptr nocapture) nounwind

declare void @sha_update(%struct.SHA_INFO* nocapture, i8* nocapture, i32) nounwind
declare void @sha_update(ptr nocapture, ptr nocapture, i32) nounwind

declare i64 @fread(i8* noalias nocapture, i64, i64, %struct.FILE* noalias nocapture) nounwind
declare i64 @fread(ptr noalias nocapture, i64, i64, ptr noalias nocapture) nounwind

declare i32 @main(i32, i8** nocapture) nounwind
declare i32 @main(i32, ptr nocapture) nounwind

declare noalias %struct.FILE* @fopen(i8* noalias nocapture, i8* noalias nocapture) nounwind
declare noalias ptr @fopen(ptr noalias nocapture, ptr noalias nocapture) nounwind

declare i32 @fclose(%struct.FILE* nocapture) nounwind
declare i32 @fclose(ptr nocapture) nounwind

declare void @sha_stream(%struct.SHA_INFO* nocapture, %struct.FILE* nocapture) nounwind
declare void @sha_stream(ptr nocapture, ptr nocapture) nounwind

define void @sha_stream_bb3_2E_i(%struct.SHA_INFO* %sha_info, i8* %data1, i32, i8** %buffer_addr.0.i.out, i32* %count_addr.0.i.out) nounwind {
define void @sha_stream_bb3_2E_i(ptr %sha_info, ptr %data1, i32, ptr %buffer_addr.0.i.out, ptr %count_addr.0.i.out) nounwind {
; CHECK-LABEL: 'sha_stream_bb3_2E_i'
; CHECK-NEXT: Determining loop execution counts for: @sha_stream_bb3_2E_i
; CHECK-NEXT: Loop %bb3.i: backedge-taken count is ((63 + (-1 * (63 smin %0)) + %0) /u 64)
Expand All @@ -50,38 +50,36 @@ newFuncRoot:
br label %bb3.i

sha_update.exit.exitStub: ; preds = %bb3.i
store i8* %buffer_addr.0.i, i8** %buffer_addr.0.i.out
store i32 %count_addr.0.i, i32* %count_addr.0.i.out
store ptr %buffer_addr.0.i, ptr %buffer_addr.0.i.out
store i32 %count_addr.0.i, ptr %count_addr.0.i.out
ret void

bb2.i: ; preds = %bb3.i
%1 = getelementptr %struct.SHA_INFO, %struct.SHA_INFO* %sha_info, i64 0, i32 3
%2 = bitcast [16 x i32]* %1 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %buffer_addr.0.i, i64 64, i1 false)
%3 = getelementptr %struct.SHA_INFO, %struct.SHA_INFO* %sha_info, i64 0, i32 3, i64 0
%4 = bitcast i32* %3 to i8*
%1 = getelementptr %struct.SHA_INFO, ptr %sha_info, i64 0, i32 3
call void @llvm.memcpy.p0.p0.i64(ptr %1, ptr %buffer_addr.0.i, i64 64, i1 false)
%2 = getelementptr %struct.SHA_INFO, ptr %sha_info, i64 0, i32 3, i64 0
br label %codeRepl

codeRepl: ; preds = %bb2.i
call void @sha_stream_bb3_2E_i_bb1_2E_i_2E_i(i8* %4)
call void @sha_stream_bb3_2E_i_bb1_2E_i_2E_i(ptr %2)
br label %byte_reverse.exit.i

byte_reverse.exit.i: ; preds = %codeRepl
call fastcc void @sha_transform(%struct.SHA_INFO* %sha_info) nounwind
%5 = getelementptr i8, i8* %buffer_addr.0.i, i64 64
%6 = add i32 %count_addr.0.i, -64
call fastcc void @sha_transform(ptr %sha_info) nounwind
%3 = getelementptr i8, ptr %buffer_addr.0.i, i64 64
%4 = add i32 %count_addr.0.i, -64
br label %bb3.i

bb3.i: ; preds = %byte_reverse.exit.i, %newFuncRoot
%buffer_addr.0.i = phi i8* [ %data1, %newFuncRoot ], [ %5, %byte_reverse.exit.i ]
%count_addr.0.i = phi i32 [ %0, %newFuncRoot ], [ %6, %byte_reverse.exit.i ]
%7 = icmp sgt i32 %count_addr.0.i, 63
br i1 %7, label %bb2.i, label %sha_update.exit.exitStub
%buffer_addr.0.i = phi ptr [ %data1, %newFuncRoot ], [ %3, %byte_reverse.exit.i ]
%count_addr.0.i = phi i32 [ %0, %newFuncRoot ], [ %4, %byte_reverse.exit.i ]
%5 = icmp sgt i32 %count_addr.0.i, 63
br i1 %5, label %bb2.i, label %sha_update.exit.exitStub
}

declare void @sha_stream_bb3_2E_i_bb1_2E_i_2E_i(i8*) nounwind
declare void @sha_stream_bb3_2E_i_bb1_2E_i_2E_i(ptr) nounwind

declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind
declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind

8 changes: 4 additions & 4 deletions llvm/test/Analysis/ScalarEvolution/trip-count4.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

; ScalarEvolution should be able to compute a loop exit value for %indvar.i8.

define void @another_count_down_signed(double* %d, i64 %n) nounwind {
define void @another_count_down_signed(ptr %d, i64 %n) nounwind {
; CHECK-LABEL: 'another_count_down_signed'
; CHECK-NEXT: Determining loop execution counts for: @another_count_down_signed
; CHECK-NEXT: Loop %loop: backedge-taken count is (-11 + %n)
Expand All @@ -20,10 +20,10 @@ loop: ; preds = %loop, %entry
%indvar = phi i64 [ %n, %entry ], [ %indvar.next, %loop ] ; <i64> [#uses=4]
%s0 = shl i64 %indvar, 8 ; <i64> [#uses=1]
%indvar.i8 = ashr i64 %s0, 8 ; <i64> [#uses=1]
%t0 = getelementptr double, double* %d, i64 %indvar.i8 ; <double*> [#uses=2]
%t1 = load double, double* %t0 ; <double> [#uses=1]
%t0 = getelementptr double, ptr %d, i64 %indvar.i8 ; <ptr> [#uses=2]
%t1 = load double, ptr %t0 ; <double> [#uses=1]
%t2 = fmul double %t1, 1.000000e-01 ; <double> [#uses=1]
store double %t2, double* %t0
store double %t2, ptr %t0
%indvar.next = sub i64 %indvar, 1 ; <i64> [#uses=2]
%exitcond = icmp eq i64 %indvar.next, 10 ; <i1> [#uses=1]
br i1 %exitcond, label %return, label %loop
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Analysis/ScalarEvolution/trip-count5.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"

define float @t(float* %pTmp1, float* %peakWeight, float* %nrgReducePeakrate, i32 %bim) nounwind {
define float @t(ptr %pTmp1, ptr %peakWeight, ptr %nrgReducePeakrate, i32 %bim) nounwind {
; CHECK-LABEL: Classifying expressions for: @t
entry:
%tmp3 = load float, float* %peakWeight, align 4
%tmp3 = load float, ptr %peakWeight, align 4
%tmp2538 = icmp sgt i32 %bim, 0
br i1 %tmp2538, label %bb.nph, label %bb4

Expand All @@ -20,17 +20,17 @@ bb:
%hiPart.035 = phi i32 [ %tmp12, %bb1 ], [ 0, %bb.nph ]
%peakCount.034 = phi float [ %tmp19, %bb1 ], [ %tmp3, %bb.nph ]
%tmp6 = sext i32 %hiPart.035 to i64
%tmp7 = getelementptr float, float* %pTmp1, i64 %tmp6
%tmp7 = getelementptr float, ptr %pTmp1, i64 %tmp6
; CHECK: %tmp6 = sext i32 %hiPart.035 to i64
; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%bb>
%tmp8 = load float, float* %tmp7, align 4
%tmp8 = load float, ptr %tmp7, align 4
%tmp10 = fadd float %tmp8, %distERBhi.036
%tmp12 = add i32 %hiPart.035, 1
%tmp15 = sext i32 %tmp12 to i64
%tmp16 = getelementptr float, float* %peakWeight, i64 %tmp15
%tmp16 = getelementptr float, ptr %peakWeight, i64 %tmp15
; CHECK: %tmp15 = sext i32 %tmp12 to i64
; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%bb>
%tmp17 = load float, float* %tmp16, align 4
%tmp17 = load float, ptr %tmp16, align 4
%tmp19 = fadd float %tmp17, %peakCount.034
br label %bb1

Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Analysis/ScalarEvolution/trip-count6.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s

@mode_table = global [4 x i32] zeroinitializer ; <[4 x i32]*> [#uses=1]
@mode_table = global [4 x i32] zeroinitializer ; <ptr> [#uses=1]

define i8 @f() {
; CHECK-LABEL: 'f'
Expand All @@ -22,8 +22,8 @@ entry:
bb: ; preds = %bb4, %entry
%mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ] ; <i8> [#uses=4]
zext i8 %mode.0 to i32 ; <i32>:1 [#uses=1]
getelementptr [4 x i32], [4 x i32]* @mode_table, i32 0, i32 %1 ; <i32*>:2 [#uses=1]
load i32, i32* %2, align 4 ; <i32>:3 [#uses=1]
getelementptr [4 x i32], ptr @mode_table, i32 0, i32 %1 ; <ptr>:2 [#uses=1]
load i32, ptr %2, align 4 ; <i32>:3 [#uses=1]
icmp eq i32 %3, %0 ; <i1>:4 [#uses=1]
br i1 %4, label %bb1, label %bb2

Expand Down
130 changes: 65 additions & 65 deletions llvm/test/Analysis/ScalarEvolution/trip-count7.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,62 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3

%struct.complex = type { float, float }
%struct.element = type { i32, i32 }
%struct.node = type { %struct.node*, %struct.node*, i32 }
@seed = external global i64 ; <i64*> [#uses=0]
@_2E_str = external constant [18 x i8], align 1 ; <[18 x i8]*> [#uses=0]
@_2E_str1 = external constant [4 x i8], align 1 ; <[4 x i8]*> [#uses=0]
@value = external global float ; <float*> [#uses=0]
@fixed = external global float ; <float*> [#uses=0]
@floated = external global float ; <float*> [#uses=0]
@permarray = external global [11 x i32], align 32 ; <[11 x i32]*> [#uses=0]
@pctr = external global i32 ; <i32*> [#uses=0]
@tree = external global %struct.node* ; <%struct.node**> [#uses=0]
@stack = external global [4 x i32], align 16 ; <[4 x i32]*> [#uses=0]
@cellspace = external global [19 x %struct.element], align 32 ; <[19 x %struct.element]*> [#uses=0]
@freelist = external global i32 ; <i32*> [#uses=0]
@movesdone = external global i32 ; <i32*> [#uses=0]
@ima = external global [41 x [41 x i32]], align 32 ; <[41 x [41 x i32]]*> [#uses=0]
@imb = external global [41 x [41 x i32]], align 32 ; <[41 x [41 x i32]]*> [#uses=0]
@imr = external global [41 x [41 x i32]], align 32 ; <[41 x [41 x i32]]*> [#uses=0]
@rma = external global [41 x [41 x float]], align 32 ; <[41 x [41 x float]]*> [#uses=0]
@rmb = external global [41 x [41 x float]], align 32 ; <[41 x [41 x float]]*> [#uses=0]
@rmr = external global [41 x [41 x float]], align 32 ; <[41 x [41 x float]]*> [#uses=0]
@piececount = external global [4 x i32], align 16 ; <[4 x i32]*> [#uses=0]
@class = external global [13 x i32], align 32 ; <[13 x i32]*> [#uses=0]
@piecemax = external global [13 x i32], align 32 ; <[13 x i32]*> [#uses=0]
@puzzl = external global [512 x i32], align 32 ; <[512 x i32]*> [#uses=0]
@p = external global [13 x [512 x i32]], align 32 ; <[13 x [512 x i32]]*> [#uses=0]
@n = external global i32 ; <i32*> [#uses=0]
@kount = external global i32 ; <i32*> [#uses=0]
@sortlist = external global [5001 x i32], align 32 ; <[5001 x i32]*> [#uses=0]
@biggest = external global i32 ; <i32*> [#uses=0]
@littlest = external global i32 ; <i32*> [#uses=0]
@top = external global i32 ; <i32*> [#uses=0]
@z = external global [257 x %struct.complex], align 32 ; <[257 x %struct.complex]*> [#uses=0]
@w = external global [257 x %struct.complex], align 32 ; <[257 x %struct.complex]*> [#uses=0]
@e = external global [130 x %struct.complex], align 32 ; <[130 x %struct.complex]*> [#uses=0]
@zr = external global float ; <float*> [#uses=0]
@zi = external global float ; <float*> [#uses=0]
%struct.node = type { ptr, ptr, i32 }
@seed = external global i64 ; <ptr> [#uses=0]
@_2E_str = external constant [18 x i8], align 1 ; <ptr> [#uses=0]
@_2E_str1 = external constant [4 x i8], align 1 ; <ptr> [#uses=0]
@value = external global float ; <ptr> [#uses=0]
@fixed = external global float ; <ptr> [#uses=0]
@floated = external global float ; <ptr> [#uses=0]
@permarray = external global [11 x i32], align 32 ; <ptr> [#uses=0]
@pctr = external global i32 ; <ptr> [#uses=0]
@tree = external global ptr ; <ptr> [#uses=0]
@stack = external global [4 x i32], align 16 ; <ptr> [#uses=0]
@cellspace = external global [19 x %struct.element], align 32 ; <ptr> [#uses=0]
@freelist = external global i32 ; <ptr> [#uses=0]
@movesdone = external global i32 ; <ptr> [#uses=0]
@ima = external global [41 x [41 x i32]], align 32 ; <ptr> [#uses=0]
@imb = external global [41 x [41 x i32]], align 32 ; <ptr> [#uses=0]
@imr = external global [41 x [41 x i32]], align 32 ; <ptr> [#uses=0]
@rma = external global [41 x [41 x float]], align 32 ; <ptr> [#uses=0]
@rmb = external global [41 x [41 x float]], align 32 ; <ptr> [#uses=0]
@rmr = external global [41 x [41 x float]], align 32 ; <ptr> [#uses=0]
@piececount = external global [4 x i32], align 16 ; <ptr> [#uses=0]
@class = external global [13 x i32], align 32 ; <ptr> [#uses=0]
@piecemax = external global [13 x i32], align 32 ; <ptr> [#uses=0]
@puzzl = external global [512 x i32], align 32 ; <ptr> [#uses=0]
@p = external global [13 x [512 x i32]], align 32 ; <ptr> [#uses=0]
@n = external global i32 ; <ptr> [#uses=0]
@kount = external global i32 ; <ptr> [#uses=0]
@sortlist = external global [5001 x i32], align 32 ; <ptr> [#uses=0]
@biggest = external global i32 ; <ptr> [#uses=0]
@littlest = external global i32 ; <ptr> [#uses=0]
@top = external global i32 ; <ptr> [#uses=0]
@z = external global [257 x %struct.complex], align 32 ; <ptr> [#uses=0]
@w = external global [257 x %struct.complex], align 32 ; <ptr> [#uses=0]
@e = external global [130 x %struct.complex], align 32 ; <ptr> [#uses=0]
@zr = external global float ; <ptr> [#uses=0]
@zi = external global float ; <ptr> [#uses=0]

declare void @Initrand() nounwind

declare i32 @Rand() nounwind

declare void @Try(i32, i32*, i32*, i32*, i32*, i32*) nounwind
declare void @Try(i32, ptr, ptr, ptr, ptr, ptr) nounwind

declare i32 @puts(i8* nocapture) nounwind
declare i32 @puts(ptr nocapture) nounwind

declare void @Queens(i32) nounwind

declare i32 @printf(i8* nocapture, ...) nounwind
declare i32 @printf(ptr nocapture, ...) nounwind

declare i32 @main() nounwind

declare void @Doit() nounwind

declare void @Doit_bb7([15 x i32]*, [17 x i32]*, [9 x i32]*) nounwind
declare void @Doit_bb7(ptr, ptr, ptr) nounwind

define void @Doit_bb7_2E_i([9 x i32]* %x1, [15 x i32]* %c, [17 x i32]* %b, [9 x i32]* %a, i32* %q, i32* %x1.sub, i32* %b9, i32* %a10, i32* %c11) nounwind {
define void @Doit_bb7_2E_i(ptr %x1, ptr %c, ptr %b, ptr %a, ptr %q, ptr %x1.sub, ptr %b9, ptr %a10, ptr %c11) nounwind {
; CHECK-LABEL: 'Doit_bb7_2E_i'
; CHECK-NEXT: Determining loop execution counts for: @Doit_bb7_2E_i
; CHECK-NEXT: Loop %bb7.i: Unpredictable backedge-taken count.
Expand All @@ -76,68 +76,68 @@ Try.exit.exitStub: ; preds = %bb7.i

bb.i: ; preds = %bb7.i
%tmp = add i32 %j.0.i, 1 ; <i32> [#uses=5]
store i32 0, i32* %q, align 4
store i32 0, ptr %q, align 4
%tmp1 = sext i32 %tmp to i64 ; <i64> [#uses=1]
%tmp2 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp1 ; <i32*> [#uses=1]
%tmp3 = load i32, i32* %tmp2, align 4 ; <i32> [#uses=1]
%tmp2 = getelementptr [9 x i32], ptr %a, i64 0, i64 %tmp1 ; <ptr> [#uses=1]
%tmp3 = load i32, ptr %tmp2, align 4 ; <i32> [#uses=1]
%tmp4 = icmp eq i32 %tmp3, 0 ; <i1> [#uses=1]
br i1 %tmp4, label %bb.i.bb7.i.backedge_crit_edge, label %bb1.i

bb1.i: ; preds = %bb.i
%tmp5 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
%tmp6 = sext i32 %tmp5 to i64 ; <i64> [#uses=1]
%tmp7 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp6 ; <i32*> [#uses=1]
%tmp8 = load i32, i32* %tmp7, align 4 ; <i32> [#uses=1]
%tmp7 = getelementptr [17 x i32], ptr %b, i64 0, i64 %tmp6 ; <ptr> [#uses=1]
%tmp8 = load i32, ptr %tmp7, align 4 ; <i32> [#uses=1]
%tmp9 = icmp eq i32 %tmp8, 0 ; <i1> [#uses=1]
br i1 %tmp9, label %bb1.i.bb7.i.backedge_crit_edge, label %bb2.i

bb2.i: ; preds = %bb1.i
%tmp10 = sub i32 7, %j.0.i ; <i32> [#uses=1]
%tmp11 = sext i32 %tmp10 to i64 ; <i64> [#uses=1]
%tmp12 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp11 ; <i32*> [#uses=1]
%tmp13 = load i32, i32* %tmp12, align 4 ; <i32> [#uses=1]
%tmp12 = getelementptr [15 x i32], ptr %c, i64 0, i64 %tmp11 ; <ptr> [#uses=1]
%tmp13 = load i32, ptr %tmp12, align 4 ; <i32> [#uses=1]
%tmp14 = icmp eq i32 %tmp13, 0 ; <i1> [#uses=1]
br i1 %tmp14, label %bb2.i.bb7.i.backedge_crit_edge, label %bb3.i

bb3.i: ; preds = %bb2.i
%tmp15 = getelementptr [9 x i32], [9 x i32]* %x1, i64 0, i64 1 ; <i32*> [#uses=1]
store i32 %tmp, i32* %tmp15, align 4
%tmp15 = getelementptr [9 x i32], ptr %x1, i64 0, i64 1 ; <ptr> [#uses=1]
store i32 %tmp, ptr %tmp15, align 4
%tmp16 = sext i32 %tmp to i64 ; <i64> [#uses=1]
%tmp17 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp16 ; <i32*> [#uses=1]
store i32 0, i32* %tmp17, align 4
%tmp17 = getelementptr [9 x i32], ptr %a, i64 0, i64 %tmp16 ; <ptr> [#uses=1]
store i32 0, ptr %tmp17, align 4
%tmp18 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
%tmp19 = sext i32 %tmp18 to i64 ; <i64> [#uses=1]
%tmp20 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp19 ; <i32*> [#uses=1]
store i32 0, i32* %tmp20, align 4
%tmp20 = getelementptr [17 x i32], ptr %b, i64 0, i64 %tmp19 ; <ptr> [#uses=1]
store i32 0, ptr %tmp20, align 4
%tmp21 = sub i32 7, %j.0.i ; <i32> [#uses=1]
%tmp22 = sext i32 %tmp21 to i64 ; <i64> [#uses=1]
%tmp23 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp22 ; <i32*> [#uses=1]
store i32 0, i32* %tmp23, align 4
call void @Try(i32 2, i32* %q, i32* %b9, i32* %a10, i32* %c11, i32* %x1.sub) nounwind
%tmp24 = load i32, i32* %q, align 4 ; <i32> [#uses=1]
%tmp23 = getelementptr [15 x i32], ptr %c, i64 0, i64 %tmp22 ; <ptr> [#uses=1]
store i32 0, ptr %tmp23, align 4
call void @Try(i32 2, ptr %q, ptr %b9, ptr %a10, ptr %c11, ptr %x1.sub) nounwind
%tmp24 = load i32, ptr %q, align 4 ; <i32> [#uses=1]
%tmp25 = icmp eq i32 %tmp24, 0 ; <i1> [#uses=1]
br i1 %tmp25, label %bb5.i, label %bb3.i.bb7.i.backedge_crit_edge

bb5.i: ; preds = %bb3.i
%tmp26 = sext i32 %tmp to i64 ; <i64> [#uses=1]
%tmp27 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp26 ; <i32*> [#uses=1]
store i32 1, i32* %tmp27, align 4
%tmp27 = getelementptr [9 x i32], ptr %a, i64 0, i64 %tmp26 ; <ptr> [#uses=1]
store i32 1, ptr %tmp27, align 4
%tmp28 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
%tmp29 = sext i32 %tmp28 to i64 ; <i64> [#uses=1]
%tmp30 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp29 ; <i32*> [#uses=1]
store i32 1, i32* %tmp30, align 4
%tmp30 = getelementptr [17 x i32], ptr %b, i64 0, i64 %tmp29 ; <ptr> [#uses=1]
store i32 1, ptr %tmp30, align 4
%tmp31 = sub i32 7, %j.0.i ; <i32> [#uses=1]
%tmp32 = sext i32 %tmp31 to i64 ; <i64> [#uses=1]
%tmp33 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp32 ; <i32*> [#uses=1]
store i32 1, i32* %tmp33, align 4
%tmp33 = getelementptr [15 x i32], ptr %c, i64 0, i64 %tmp32 ; <ptr> [#uses=1]
store i32 1, ptr %tmp33, align 4
br label %bb7.i.backedge

bb7.i.backedge: ; preds = %bb3.i.bb7.i.backedge_crit_edge, %bb2.i.bb7.i.backedge_crit_edge, %bb1.i.bb7.i.backedge_crit_edge, %bb.i.bb7.i.backedge_crit_edge, %bb5.i
br label %bb7.i

bb7.i: ; preds = %bb7.i.backedge, %newFuncRoot
%j.0.i = phi i32 [ 0, %newFuncRoot ], [ %tmp, %bb7.i.backedge ] ; <i32> [#uses=8]
%tmp34 = load i32, i32* %q, align 4 ; <i32> [#uses=1]
%tmp34 = load i32, ptr %q, align 4 ; <i32> [#uses=1]
%tmp35 = icmp eq i32 %tmp34, 0 ; <i1> [#uses=1]
%tmp36 = icmp ne i32 %j.0.i, 8 ; <i1> [#uses=1]
%tmp37 = and i1 %tmp35, %tmp36 ; <i1> [#uses=1]
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Analysis/ScalarEvolution/trip-count9.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
; Every combination of
; - starting at 0, 1, or %x
; - steping by 1 or 2
; - stopping at %n or %n*2
; - stopping at %n or ptr2
; - using nsw, or not

; Some of these represent missed opportunities.
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Analysis/ScalarEvolution/tripmultiple_calculation.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
;
; CHECK: Loop %for.body: Trip multiple is 1

define i32 @foo(i32 %a, i32 %b, i32* %c) {
define i32 @foo(i32 %a, i32 %b, ptr %c) {
entry:
%cmp = icmp ult i32 %a, %b
%cond = select i1 %cmp, i32 %a, i32 %b
Expand All @@ -32,8 +32,8 @@ for.cond.cleanup: ; preds = %for.cond.cleanup.lo

for.body: ; preds = %for.body.preheader, %for.body
%i.09 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%arrayidx = getelementptr inbounds i32, i32* %c, i32 %i.09
store i32 %i.09, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %c, i32 %i.09
store i32 %i.09, ptr %arrayidx, align 4
%inc = add nuw i32 %i.09, 1
%cmp1 = icmp ult i32 %inc, %add
br i1 %cmp1, label %for.body, label %for.cond.cleanup.loopexit
Expand Down Expand Up @@ -70,13 +70,13 @@ for.cond.cleanup: ; preds = %for.cond.cleanup.lo

for.body: ; preds = %for.body.preheader, %for.body
%i.05 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str2, i32 0, i32 0), i32 %i.05)
%call = tail call i32 (ptr, ...) @printf(ptr @.str2, i32 %i.05)
%inc = add nuw i32 %i.05, 1
%cmp = icmp eq i32 %inc, %mul
br i1 %cmp, label %for.cond.cleanup.loopexit, label %for.body
}

declare i32 @printf(i8* nocapture readonly, ...)
declare i32 @printf(ptr nocapture readonly, ...)


; If we couldn't prove no overflow for the multiply expression 24 * n,
Expand Down
Loading