-; 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
; 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
; 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"
define i32 @test(i32 %J) {
+; CHECK-LABEL: @test(
+; CHECK-NOT: ret i32 0
entry:
br label %bb2
-; RUN: opt < %s -indvars -S | grep sext | count 1
+; RUN: opt < %s -indvars -S | FileCheck %s
; ModuleID = '<stdin>'
; Provide legal integer types.
@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]
-; 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"
@f = external global i32* ; <i32**> [#uses=3]
define void @foo() nounwind {
+; CHECK-LABEL: @foo(
+; CHECK-NOT: sext
bb1.thread:
br label %bb1
-; 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];
@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
-; 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.
@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
-; 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.
@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
; 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
-; 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
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
; 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"
@A = external global i32 ; <i32*> [#uses=1]
define i32 @quadratic_setlt() {
+; CHECK-LABEL: @quadratic_setlt(
+; CHECK-NOT: mul
entry:
br label %loop
-; 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.
%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
-; 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.
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
-; 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.
;
@.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
-; 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]
-; 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
-; 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
-; 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
-; 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
-; 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
-; 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:
-; 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:
-; 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
-; 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.
@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