Skip to content

Commit

Permalink
[IndVars] Un-grepify test; NFC
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sanjoy committed Aug 3, 2016
1 parent 3ed1883 commit 5494503
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 37 deletions.
5 changes: 3 additions & 2 deletions test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
; RUN: opt < %s -indvars -S | \
; RUN: grep "ret i32 152"
; RUN: opt < %s -indvars -S | FileCheck %s

define i32 @main() {
; CHECK-LABEL: @main(
; CHECK: ret i32 152
entry:
br label %no_exit

Expand Down
5 changes: 3 additions & 2 deletions test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
; PR726
; RUN: opt < %s -indvars -S | \
; RUN: grep "ret i32 27"
; RUN: opt < %s -indvars -S | FileCheck %s

; Make sure to compute the right exit value based on negative strides.

define i32 @test() {
; CHECK-LABEL: @test(
; CHECK: ret i32 27
entry:
br label %cond_true

Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; PR1015
; RUN: opt < %s -indvars -S | not grep "ret i32 0"
; RUN: opt < %s -indvars -S | FileCheck %s

target datalayout = "e-p:32:32"
target triple = "i686-apple-darwin8"
Expand All @@ -8,6 +8,8 @@ target triple = "i686-apple-darwin8"


define i32 @test(i32 %J) {
; CHECK-LABEL: @test(
; CHECK-NOT: ret i32 0
entry:
br label %bb2

Expand Down
5 changes: 4 additions & 1 deletion test/Transforms/IndVarSimplify/2008-09-02-IVType.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -indvars -S | grep sext | count 1
; RUN: opt < %s -indvars -S | FileCheck %s
; ModuleID = '<stdin>'

; Provide legal integer types.
Expand All @@ -21,6 +21,9 @@ target datalayout = "n8:16:32:64"
@llvm.used = appending global [1 x i8*] [ i8* bitcast (i16 (%struct.JPEGGlobals*)* @ExtractBufferedBlocksIgnored to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]

define signext i16 @ExtractBufferedBlocksIgnored(%struct.JPEGGlobals* %globp) nounwind {
; CHECK-LABEL: @ExtractBufferedBlocksIgnored(
; CHECK: sext
; CHECK-NOT: sext
entry:
%tmp4311 = getelementptr %struct.JPEGGlobals, %struct.JPEGGlobals* %globp, i32 0, i32 70 ; <i32*> [#uses=1]
%tmp4412 = load i32, i32* %tmp4311, align 16 ; <i32> [#uses=2]
Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -indvars -S | not grep "sext"
; RUN: opt < %s -indvars -S | FileCheck %s
; ModuleID = '<stdin>'
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"
target triple = "x86_64-apple-darwin9.6"
Expand All @@ -10,6 +10,8 @@ target triple = "x86_64-apple-darwin9.6"
@f = external global i32* ; <i32**> [#uses=3]

define void @foo() nounwind {
; CHECK-LABEL: @foo(
; CHECK-NOT: sext
bb1.thread:
br label %bb1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -indvars -instcombine -S | not grep "[sz]ext"
; RUN: opt < %s -indvars -instcombine -S | FileCheck %s
; ModuleID = '<stdin>'
;extern int *a, *b, *c, *d, *e, *f; /* 64 bit */
;extern int K[256];
Expand All @@ -24,6 +24,9 @@ target triple = "x86_64-apple-darwin9.6"
@K = external global [256 x i32] ; <[256 x i32]*> [#uses=3]

define void @foo() nounwind {
; CHECK-LABEL: @foo(
; CHECK-NOT: sext
; CHECK-NOT: zext
bb1.thread:
br label %bb1

Expand Down
6 changes: 4 additions & 2 deletions test/Transforms/IndVarSimplify/ashr-tripcount.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: opt < %s -indvars -S > %t
; RUN: grep sext %t | count 1
; RUN: opt < %s -indvars -S | FileCheck %s

; Indvars should be able to eliminate all of the sign extensions
; inside the loop.
Expand All @@ -11,6 +10,9 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
@i_pow_2_025_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1]

define void @foo(i32 %gain, i32 %noOfLines, i32* %quaSpectrum, float* %iquaSpectrum, float* %pow4_3_tab_ptr) nounwind {
; CHECK-LABEL: @foo(
; CHECK: sext
; CHECK-NOT: sext
entry:
%t0 = icmp slt i32 %gain, 0 ; <i1> [#uses=1]
br i1 %t0, label %bb1, label %bb2
Expand Down
7 changes: 6 additions & 1 deletion test/Transforms/IndVarSimplify/eliminate-max.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -indvars | grep "= icmp" | count 3
; RUN: opt < %s -S -indvars | FileCheck %s
; PR4914.ll

; Indvars should be able to do range analysis and eliminate icmps.
Expand All @@ -10,6 +10,11 @@
@0 = private constant [4 x i8] c"%d\0A\00", align 1 ; <[4 x i8]*> [#uses=1]

define i32 @main() nounwind {
; CHECK-LABEL: @main(
; CHECK: = icmp
; CHECK: = icmp
; CHECK: = icmp
; CHECK-NOT: = icmp
bb:
br label %bb1

Expand Down
5 changes: 3 additions & 2 deletions test/Transforms/IndVarSimplify/exit_value_tests.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
; these loops all have predictable exit values we can replace the use outside
; of the loop with a closed-form computation, making the loop dead.
;
; RUN: opt < %s -indvars -loop-deletion -simplifycfg | \
; RUN: llvm-dis | not grep br
; RUN: opt < %s -indvars -loop-deletion -simplifycfg -S | FileCheck %s

; CHECK-NOT: br

define i32 @polynomial_constant() {
; <label>:0
Expand Down
6 changes: 5 additions & 1 deletion test/Transforms/IndVarSimplify/lftr-promote.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -indvars -S | grep add | count 1
; RUN: opt < %s -indvars -S | FileCheck %s

; Indvars should be able to compute the exit value of this loop
; without any additional arithmetic. The only add needed should
Expand All @@ -7,6 +7,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 void @foo(double* %p, i32 %n) nounwind {
; CHECK-LABEL: @foo(
; CHECK: add
; CHECK-NOT: add

entry:
%0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
br i1 %0, label %bb.nph, label %return
Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/lftr_simple.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; LFTR should eliminate the need for the computation of i*i completely. It
; is only used to compute the exit value.
; RUN: opt < %s -indvars -dce -S | not grep mul
; RUN: opt < %s -indvars -dce -S | FileCheck %s

; Provide legal integer types.
target datalayout = "n8:16:32:64"
Expand All @@ -9,6 +9,8 @@ target datalayout = "n8:16:32:64"
@A = external global i32 ; <i32*> [#uses=1]

define i32 @quadratic_setlt() {
; CHECK-LABEL: @quadratic_setlt(
; CHECK-NOT: mul
entry:
br label %loop

Expand Down
5 changes: 3 additions & 2 deletions test/Transforms/IndVarSimplify/loop_evaluate10.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: opt < %s -indvars -S \
; RUN: | grep "%b.1 = phi i32 [ 2, %bb ], [ 1, %bb2 ]"
; RUN: opt < %s -indvars -S | FileCheck %s
;
; This loop has multiple exits, and the value of %b1 depends on which
; exit is taken. Indvars should correctly compute the exit values.
Expand All @@ -15,6 +14,8 @@ target triple = "x86_64-pc-linux-gnu"
%struct..0anon = type <{ i8, [3 x i8] }>

define i32 @main() nounwind {
; CHECK-LABEL: @main(
; CHECK: %b.1 = phi i32 [ 2, %bb ], [ 1, %bb2 ]
entry:
br label %bb2

Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/loop_evaluate8.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -indvars -S | not grep select
; RUN: opt < %s -indvars -S | FileCheck %s

; This loop has backedge-taken-count zero. Indvars shouldn't expand any
; instructions to compute a trip count.
Expand All @@ -7,6 +7,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
target triple = "i386-pc-linux-gnu"

define i8* @string_expandtabs() nounwind {
; CHECK-LABEL: @string_expandtabs(
; CHECK-NOT: select
entry:
br i1 undef, label %bb33, label %bb1

Expand Down
8 changes: 5 additions & 3 deletions test/Transforms/IndVarSimplify/loop_evaluate9.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
; RUN: opt < %s -indvars -S > %t
; RUN: grep "[%]tmp7 = icmp eq i8 -28, -28" %t
; RUN: grep "[%]tmp8 = icmp eq i8 63, 63" %t
; RUN: opt < %s -indvars -S | FileCheck %s
; PR4477
; Indvars should compute the exit values in loop.
;
Expand All @@ -16,6 +14,10 @@ target triple = "i386-pc-linux-gnu"
@.str = internal constant [13 x i8] c"fc70a00.adb\00\00", align 1 ; <[13 x i8]*> [#uses=1]

define void @_ada_cc70a02() {
; CHECK-LABEL: @_ada_cc70a02(
; CHECK: [%]tmp7 = icmp eq i8 -28, -28
; CHECK: [%]tmp8 = icmp eq i8 63, 63

entry:
br label %bb1.i

Expand Down
5 changes: 3 additions & 2 deletions test/Transforms/IndVarSimplify/loop_evaluate_2.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
; RUN: opt < %s -indvars -loop-deletion -simplifycfg | opt \
; RUN: -analyze -loops | not grep "^Loop Containing"
; RUN: opt < %s -indvars -loop-deletion -simplifycfg | opt -analyze -loops | FileCheck %s
; PR1179

; CHECK-NOT: Loop Containing

define i32 @ltst(i32 %x) {
entry:
icmp sgt i32 %x, 0 ; <i1>:0 [#uses=1]
Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/loop_evaluate_3.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
; RUN: opt < %s -indvars -S | grep "ret i32 600000"
; RUN: opt < %s -indvars -S | FileCheck %s
; PR1179

define i32 @foo() {
; CHECK-LABEL: @foo(
; CHECK: ret i32 600000
entry:
br label %bb5

Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/loop_evaluate_4.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
; RUN: opt < %s -indvars -S | grep "ret i32 9900"
; RUN: opt < %s -indvars -S | FileCheck %s
; PR1179

define i32 @test4() {
; CHECK-LABEL: @test4(
; CHECK: ret i32 9900
entry:
br label %bb7

Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/loop_evaluate_5.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
; RUN: opt < %s -indvars -S | grep "120, %bb2.bb3_crit_edge"
; RUN: opt < %s -indvars -S | FileCheck %s
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"
target triple = "i686-pc-linux-gnu"

; Indvars should be able to compute an exit value for %tmp1.

define i32 @testcase(i5 zeroext %k) nounwind readnone {
; CHECK-LABEL: @testcase
; CHECK: 120, %bb2.bb3_crit_edge
entry:
br i1 false, label %bb3, label %bb.nph

Expand Down
6 changes: 5 additions & 1 deletion test/Transforms/IndVarSimplify/loop_evaluate_6.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
; RUN: opt < %s -indvars -loop-deletion -S | grep phi | count 1
; RUN: opt < %s -indvars -loop-deletion -S | FileCheck %s

define i32 @test(i32 %x_offs) nounwind readnone {
; CHECK-LABEL: @test(
; CHECK: phi
; CHECK-NOT: phi

entry:
%0 = icmp sgt i32 %x_offs, 4 ; <i1> [#uses=1]
br i1 %0, label %bb.nph, label %bb2
Expand Down
8 changes: 5 additions & 3 deletions test/Transforms/IndVarSimplify/masked-iv.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
; RUN: opt < %s -indvars -S > %t
; RUN: not grep trunc %t
; RUN: grep and %t | count 1
; RUN: opt < %s -indvars -S | FileCheck %s

; Indvars should do the IV arithmetic in the canonical IV type (i64),
; and only use one truncation.

define void @foo(i64* %A, i64* %B, i64 %n, i64 %a, i64 %s) nounwind {
; CHECK-LABEL: @foo(
; CHECK-NOT: trunc
; CHECK: and
; CHECK-NOT: and
entry:
%t0 = icmp sgt i64 %n, 0 ; <i1> [#uses=1]
br i1 %t0, label %bb.preheader, label %return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
; RUN: opt < %s -indvars -S | not grep sext
; RUN: opt < %s -indvars -S | FileCheck %s

; Provide legal integer types.
target datalayout = "n8:16:32:64"

; CHECK-NOT: sext

define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly {
entry:
Expand Down
5 changes: 3 additions & 2 deletions test/Transforms/IndVarSimplify/shrunk-constant.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; RUN: opt < %s -scalar-evolution -analyze \
; RUN: | grep "\--> (zext i4 {-7,+,-8}<%loop> to i32)"
; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s

; CHECK: --> (zext i4 {-7,+,-8}<%loop> to i32)

define fastcc void @foo() nounwind {
entry:
Expand Down
8 changes: 5 additions & 3 deletions test/Transforms/IndVarSimplify/signed-trip-count.ll
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
; RUN: opt < %s -indvars -S > %t
; RUN: not grep sext %t
; RUN: grep phi %t | count 1
; RUN: opt < %s -indvars -S | FileCheck %s

; Provide legal integer types.
target datalayout = "n8:16:32:64"


define void @foo(i64* nocapture %x, i32 %n) nounwind {
; CHECK-LABEL: @foo(
; CHECK-NOT: sext
; CHECK: phi
; CHECK-NOT: phi
entry:
%tmp102 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
br i1 %tmp102, label %bb.nph, label %return
Expand Down
4 changes: 3 additions & 1 deletion test/Transforms/IndVarSimplify/uglygep.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -indvars -S < %s | not grep uglygep
; RUN: opt -indvars -S < %s | FileCheck %s
; rdar://8197217

; Indvars should be able to emit a clean GEP here, not an uglygep.
Expand All @@ -11,6 +11,8 @@ target triple = "x86_64-apple-darwin11.0"
@tds = external global double** ; <double***> [#uses=1]

define void @init_td(i32 %tmp7) nounwind {
; CHECK-LABEL: @init_td
; CHECK-NOT: uglygep
entry:
br label %bb4

Expand Down

0 comments on commit 5494503

Please sign in to comment.