llvm.org GIT mirror llvm / 5494503
[IndVars] Un-grepify test; NFC Some of these tests need to be cleaned up further to make it obvious what they're testing, but as a first step remove all instances of "grep". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277648 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 3 years ago
24 changed file(s) with 87 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
None ; RUN: opt < %s -indvars -S | \
1 ; RUN: grep "ret i32 152"
0 ; RUN: opt < %s -indvars -S | FileCheck %s
21
32 define i32 @main() {
3 ; CHECK-LABEL: @main(
4 ; CHECK: ret i32 152
45 entry:
56 br label %no_exit
67
0 ; PR726
1 ; RUN: opt < %s -indvars -S | \
2 ; RUN: grep "ret i32 27"
1 ; RUN: opt < %s -indvars -S | FileCheck %s
32
43 ; Make sure to compute the right exit value based on negative strides.
54
65 define i32 @test() {
6 ; CHECK-LABEL: @test(
7 ; CHECK: ret i32 27
78 entry:
89 br label %cond_true
910
0 ; PR1015
1 ; RUN: opt < %s -indvars -S | not grep "ret i32 0"
1 ; RUN: opt < %s -indvars -S | FileCheck %s
22
33 target datalayout = "e-p:32:32"
44 target triple = "i686-apple-darwin8"
77
88
99 define i32 @test(i32 %J) {
10 ; CHECK-LABEL: @test(
11 ; CHECK-NOT: ret i32 0
1012 entry:
1113 br label %bb2
1214
None ; RUN: opt < %s -indvars -S | grep sext | count 1
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11 ; ModuleID = ''
22
33 ; Provide legal integer types.
2020 @llvm.used = appending global [1 x i8*] [ i8* bitcast (i16 (%struct.JPEGGlobals*)* @ExtractBufferedBlocksIgnored to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
2121
2222 define signext i16 @ExtractBufferedBlocksIgnored(%struct.JPEGGlobals* %globp) nounwind {
23 ; CHECK-LABEL: @ExtractBufferedBlocksIgnored(
24 ; CHECK: sext
25 ; CHECK-NOT: sext
2326 entry:
2427 %tmp4311 = getelementptr %struct.JPEGGlobals, %struct.JPEGGlobals* %globp, i32 0, i32 70 ; [#uses=1]
2528 %tmp4412 = load i32, i32* %tmp4311, align 16 ; [#uses=2]
None ; RUN: opt < %s -indvars -S | not grep "sext"
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11 ; ModuleID = ''
22 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-n32:64"
33 target triple = "x86_64-apple-darwin9.6"
99 @f = external global i32* ; [#uses=3]
1010
1111 define void @foo() nounwind {
12 ; CHECK-LABEL: @foo(
13 ; CHECK-NOT: sext
1214 bb1.thread:
1315 br label %bb1
1416
None ; RUN: opt < %s -indvars -instcombine -S | not grep "[sz]ext"
0 ; RUN: opt < %s -indvars -instcombine -S | FileCheck %s
11 ; ModuleID = ''
22 ;extern int *a, *b, *c, *d, *e, *f; /* 64 bit */
33 ;extern int K[256];
2323 @K = external global [256 x i32] ; <[256 x i32]*> [#uses=3]
2424
2525 define void @foo() nounwind {
26 ; CHECK-LABEL: @foo(
27 ; CHECK-NOT: sext
28 ; CHECK-NOT: zext
2629 bb1.thread:
2730 br label %bb1
2831
None ; RUN: opt < %s -indvars -S > %t
1 ; RUN: grep sext %t | count 1
0 ; RUN: opt < %s -indvars -S | FileCheck %s
21
32 ; Indvars should be able to eliminate all of the sign extensions
43 ; inside the loop.
109 @i_pow_2_025_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1]
1110
1211 define void @foo(i32 %gain, i32 %noOfLines, i32* %quaSpectrum, float* %iquaSpectrum, float* %pow4_3_tab_ptr) nounwind {
12 ; CHECK-LABEL: @foo(
13 ; CHECK: sext
14 ; CHECK-NOT: sext
1315 entry:
1416 %t0 = icmp slt i32 %gain, 0 ; [#uses=1]
1517 br i1 %t0, label %bb1, label %bb2
None ; RUN: opt < %s -S -indvars | grep "= icmp" | count 3
0 ; RUN: opt < %s -S -indvars | FileCheck %s
11 ; PR4914.ll
22
33 ; Indvars should be able to do range analysis and eliminate icmps.
99 @0 = private constant [4 x i8] c"%d\0A\00", align 1 ; <[4 x i8]*> [#uses=1]
1010
1111 define i32 @main() nounwind {
12 ; CHECK-LABEL: @main(
13 ; CHECK: = icmp
14 ; CHECK: = icmp
15 ; CHECK: = icmp
16 ; CHECK-NOT: = icmp
1217 bb:
1318 br label %bb1
1419
11 ; these loops all have predictable exit values we can replace the use outside
22 ; of the loop with a closed-form computation, making the loop dead.
33 ;
4 ; RUN: opt < %s -indvars -loop-deletion -simplifycfg | \
5 ; RUN: llvm-dis | not grep br
4 ; RUN: opt < %s -indvars -loop-deletion -simplifycfg -S | FileCheck %s
5
6 ; CHECK-NOT: br
67
78 define i32 @polynomial_constant() {
89 ;
None ; RUN: opt < %s -indvars -S | grep add | count 1
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11
22 ; Indvars should be able to compute the exit value of this loop
33 ; without any additional arithmetic. The only add needed should
66 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"
77
88 define void @foo(double* %p, i32 %n) nounwind {
9 ; CHECK-LABEL: @foo(
10 ; CHECK: add
11 ; CHECK-NOT: add
12
913 entry:
1014 %0 = icmp sgt i32 %n, 0 ; [#uses=1]
1115 br i1 %0, label %bb.nph, label %return
0 ; LFTR should eliminate the need for the computation of i*i completely. It
11 ; is only used to compute the exit value.
2 ; RUN: opt < %s -indvars -dce -S | not grep mul
2 ; RUN: opt < %s -indvars -dce -S | FileCheck %s
33
44 ; Provide legal integer types.
55 target datalayout = "n8:16:32:64"
88 @A = external global i32 ; [#uses=1]
99
1010 define i32 @quadratic_setlt() {
11 ; CHECK-LABEL: @quadratic_setlt(
12 ; CHECK-NOT: mul
1113 entry:
1214 br label %loop
1315
None ; RUN: opt < %s -indvars -S \
1 ; RUN: | grep "%b.1 = phi i32 [ 2, %bb ], [ 1, %bb2 ]"
0 ; RUN: opt < %s -indvars -S | FileCheck %s
21 ;
32 ; This loop has multiple exits, and the value of %b1 depends on which
43 ; exit is taken. Indvars should correctly compute the exit values.
1413 %struct..0anon = type <{ i8, [3 x i8] }>
1514
1615 define i32 @main() nounwind {
16 ; CHECK-LABEL: @main(
17 ; CHECK: %b.1 = phi i32 [ 2, %bb ], [ 1, %bb2 ]
1718 entry:
1819 br label %bb2
1920
None ; RUN: opt < %s -indvars -S | not grep select
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11
22 ; This loop has backedge-taken-count zero. Indvars shouldn't expand any
33 ; instructions to compute a trip count.
66 target triple = "i386-pc-linux-gnu"
77
88 define i8* @string_expandtabs() nounwind {
9 ; CHECK-LABEL: @string_expandtabs(
10 ; CHECK-NOT: select
911 entry:
1012 br i1 undef, label %bb33, label %bb1
1113
None ; RUN: opt < %s -indvars -S > %t
1 ; RUN: grep "[%]tmp7 = icmp eq i8 -28, -28" %t
2 ; RUN: grep "[%]tmp8 = icmp eq i8 63, 63" %t
0 ; RUN: opt < %s -indvars -S | FileCheck %s
31 ; PR4477
42 ; Indvars should compute the exit values in loop.
53 ;
1513 @.str = internal constant [13 x i8] c"fc70a00.adb\00\00", align 1 ; <[13 x i8]*> [#uses=1]
1614
1715 define void @_ada_cc70a02() {
16 ; CHECK-LABEL: @_ada_cc70a02(
17 ; CHECK: [%]tmp7 = icmp eq i8 -28, -28
18 ; CHECK: [%]tmp8 = icmp eq i8 63, 63
19
1820 entry:
1921 br label %bb1.i
2022
None ; RUN: opt < %s -indvars -loop-deletion -simplifycfg | opt \
1 ; RUN: -analyze -loops | not grep "^Loop Containing"
0 ; RUN: opt < %s -indvars -loop-deletion -simplifycfg | opt -analyze -loops | FileCheck %s
21 ; PR1179
2
3 ; CHECK-NOT: Loop Containing
34
45 define i32 @ltst(i32 %x) {
56 entry:
None ; RUN: opt < %s -indvars -S | grep "ret i32 600000"
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11 ; PR1179
22
33 define i32 @foo() {
4 ; CHECK-LABEL: @foo(
5 ; CHECK: ret i32 600000
46 entry:
57 br label %bb5
68
None ; RUN: opt < %s -indvars -S | grep "ret i32 9900"
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11 ; PR1179
22
33 define i32 @test4() {
4 ; CHECK-LABEL: @test4(
5 ; CHECK: ret i32 9900
46 entry:
57 br label %bb7
68
None ; RUN: opt < %s -indvars -S | grep "120, %bb2.bb3_crit_edge"
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11 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"
22 target triple = "i686-pc-linux-gnu"
33
44 ; Indvars should be able to compute an exit value for %tmp1.
55
66 define i32 @testcase(i5 zeroext %k) nounwind readnone {
7 ; CHECK-LABEL: @testcase
8 ; CHECK: 120, %bb2.bb3_crit_edge
79 entry:
810 br i1 false, label %bb3, label %bb.nph
911
None ; RUN: opt < %s -indvars -loop-deletion -S | grep phi | count 1
0 ; RUN: opt < %s -indvars -loop-deletion -S | FileCheck %s
11
22 define i32 @test(i32 %x_offs) nounwind readnone {
3 ; CHECK-LABEL: @test(
4 ; CHECK: phi
5 ; CHECK-NOT: phi
6
37 entry:
48 %0 = icmp sgt i32 %x_offs, 4 ; [#uses=1]
59 br i1 %0, label %bb.nph, label %bb2
None ; RUN: opt < %s -indvars -S > %t
1 ; RUN: not grep trunc %t
2 ; RUN: grep and %t | count 1
0 ; RUN: opt < %s -indvars -S | FileCheck %s
31
42 ; Indvars should do the IV arithmetic in the canonical IV type (i64),
53 ; and only use one truncation.
64
75 define void @foo(i64* %A, i64* %B, i64 %n, i64 %a, i64 %s) nounwind {
6 ; CHECK-LABEL: @foo(
7 ; CHECK-NOT: trunc
8 ; CHECK: and
9 ; CHECK-NOT: and
810 entry:
911 %t0 = icmp sgt i64 %n, 0 ; [#uses=1]
1012 br i1 %t0, label %bb.preheader, label %return
None ; RUN: opt < %s -indvars -S | not grep sext
0 ; RUN: opt < %s -indvars -S | FileCheck %s
11
22 ; Provide legal integer types.
33 target datalayout = "n8:16:32:64"
44
5 ; CHECK-NOT: sext
56
67 define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly {
78 entry:
None ; RUN: opt < %s -scalar-evolution -analyze \
1 ; RUN: | grep "\--> (zext i4 {-7,+,-8}<%loop> to i32)"
0 ; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s
1
2 ; CHECK: --> (zext i4 {-7,+,-8}<%loop> to i32)
23
34 define fastcc void @foo() nounwind {
45 entry:
None ; RUN: opt < %s -indvars -S > %t
1 ; RUN: not grep sext %t
2 ; RUN: grep phi %t | count 1
0 ; RUN: opt < %s -indvars -S | FileCheck %s
31
42 ; Provide legal integer types.
53 target datalayout = "n8:16:32:64"
64
75
86 define void @foo(i64* nocapture %x, i32 %n) nounwind {
7 ; CHECK-LABEL: @foo(
8 ; CHECK-NOT: sext
9 ; CHECK: phi
10 ; CHECK-NOT: phi
911 entry:
1012 %tmp102 = icmp sgt i32 %n, 0 ; [#uses=1]
1113 br i1 %tmp102, label %bb.nph, label %return
None ; RUN: opt -indvars -S < %s | not grep uglygep
0 ; RUN: opt -indvars -S < %s | FileCheck %s
11 ; rdar://8197217
22
33 ; Indvars should be able to emit a clean GEP here, not an uglygep.
1010 @tds = external global double** ; [#uses=1]
1111
1212 define void @init_td(i32 %tmp7) nounwind {
13 ; CHECK-LABEL: @init_td
14 ; CHECK-NOT: uglygep
1315 entry:
1416 br label %bb4
1517