FileCheck'ify some wc/grep based tests; NFCI.

llvm-svn: 243378
This commit is contained in:
Sanjoy Das 2015-07-28 03:50:09 +00:00
parent 635e85a647
commit 6c7a186599
2 changed files with 15 additions and 5 deletions

View File

@ -1,7 +1,10 @@
; RUN: opt < %s -O3 -o - | llc -no-integrated-as -o - | grep bork_directive | wc -l | grep 2 ; RUN: opt < %s -O3 | llc -no-integrated-as | FileCheck %s
;; We don't want branch folding to fold asm directives. ;; We don't want branch folding to fold asm directives.
; CHECK: bork_directive
; CHECK: bork_directive
define void @bork(i32 %param) { define void @bork(i32 %param) {
entry: entry:
%tmp = icmp eq i32 %param, 0 %tmp = icmp eq i32 %param, 0

View File

@ -1,38 +1,45 @@
; These tests have an infinite trip count. We obviously shouldn't remove the ; These tests have an infinite trip count. We obviously shouldn't remove the
; loops! :) ; loops! :)
; ;
; RUN: opt < %s -indvars -adce -simplifycfg -S | grep icmp | wc -l > %t2 ; RUN: opt < %s -indvars -adce -simplifycfg -S | FileCheck %s
; RUN: llvm-as < %s | llvm-dis | grep icmp | wc -l > %t1
; RUN: diff %t1 %t2
;; test for (i = 1; i != 100; i += 2) ;; test for (i = 1; i != 100; i += 2)
define i32 @infinite_linear() { define i32 @infinite_linear() {
; CHECK-LABEL: @infinite_linear(
entry: entry:
br label %loop br label %loop
loop: ; preds = %loop, %entry loop: ; preds = %loop, %entry
; CHECK-LABEL: loop:
%i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3] %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
%i.next = add i32 %i, 2 ; <i32> [#uses=1] %i.next = add i32 %i, 2 ; <i32> [#uses=1]
%c = icmp ne i32 %i, 100 ; <i1> [#uses=1] %c = icmp ne i32 %i, 100 ; <i1> [#uses=1]
; CHECK: icmp
; CHECK: br
br i1 %c, label %loop, label %loopexit br i1 %c, label %loop, label %loopexit
loopexit: ; preds = %loop loopexit: ; preds = %loop
; CHECK-LABEL: loopexit:
ret i32 %i ret i32 %i
} }
;; test for (i = 1; i*i != 63; ++i) ;; test for (i = 1; i*i != 63; ++i)
define i32 @infinite_quadratic() { define i32 @infinite_quadratic() {
; CHECK-LABEL: @infinite_quadratic(
entry: entry:
br label %loop br label %loop
loop: ; preds = %loop, %entry loop: ; preds = %loop, %entry
; CHECK-LABEL: loop:
%i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; <i32> [#uses=4] %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; <i32> [#uses=4]
%isquare = mul i32 %i, %i ; <i32> [#uses=1] %isquare = mul i32 %i, %i ; <i32> [#uses=1]
%i.next = add i32 %i, 1 ; <i32> [#uses=1] %i.next = add i32 %i, 1 ; <i32> [#uses=1]
%c = icmp ne i32 %isquare, 63 ; <i1> [#uses=1] %c = icmp ne i32 %isquare, 63 ; <i1> [#uses=1]
; CHECK: icmp
; CHECK: br
br i1 %c, label %loop, label %loopexit br i1 %c, label %loop, label %loopexit
loopexit: ; preds = %loop loopexit: ; preds = %loop
; CHECK-LABEL: loopexit:
ret i32 %i ret i32 %i
} }