; This testcase is incorrectly getting completely eliminated. There should be
; SOME instruction named %c here, even if it's a bitwise and.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep '%c'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep %c
;
ulong %test3(ulong %A) {
%c1 = cast ulong %A to ubyte
; This testcase can be simplified by "realizing" that alloca can never return
; null.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -simplifycfg | llvm-dis | not grep 'br '
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -simplifycfg | \
+; RUN: llvm-dis | not grep br
implementation ; Functions:
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret i1 false'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {ret i1 false}
bool %test(bool %V) {
%Y = setlt bool %V, false
ret bool %Y
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg | llvm-dis | not grep 'int 1'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg | llvm-dis | \
+; RUN: not grep {int 1}
; When propagating the load through the select, make sure that the load is
; inserted where the original load was, not where the select is. Not doing
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg -simplifycfg | llvm-dis | \
-; RUN: grep -v store | not grep 'int 1'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg -simplifycfg | \
+; RUN: llvm-dis | grep -v store | not grep {int 1}
; Test to make sure that instcombine does not accidentally propagate the load
; into the PHI, which would break the program.
; be eliminated. In many cases the setCC is also eliminated based on the
; constant value and the range of the casted value.
;
-; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | notcast '.*int'
+; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: notcast .*int
implementation ; Functions:
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'ret bool false'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {ret bool false}
+
bool %test(ulong %tmp.169) {
%tmp.1710 = shr ulong %tmp.169, ubyte 1
%tmp.1912 = setgt ulong %tmp.1710, 0
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep 'ret i1 true'
+; RUN: grep {ret i1 true}
; PR586
%g_07918478 = external global uint ; <uint*> [#uses=1]
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep undef
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep undef
int %test(sbyte %A) {
%B = cast sbyte %A to int
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep shl &&
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep shl
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | notcast
; This cannot be turned into a sign extending cast!
; The optimizer should be able to remove cast operation here.
-; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | not grep 'sext.*i32'
+; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep sext.*i32
bool %eq_signed_to_small_unsigned(sbyte %SB) {
%Y = cast sbyte %SB to uint ; <uint> [#uses=1]
; This test case is reduced from llvmAsmParser.cpp
; The optimizer should not remove the cast here.
-; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | grep 'sext.*i32'
+; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep sext.*i32
bool %test(short %X) {
%A = cast short %X to uint
-; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | grep 'and'
+; RUN: llvm-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep and
ulong %foo(ulong %tmp, ulong %tmp2) {
%tmp = cast ulong %tmp to uint
%tmp2 = cast ulong %tmp2 to uint
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep mul | wc -l | grep 2
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep mul | wc -l | grep 2
<4 x float> %test(<4 x float> %V) {
-;RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis |not grep memmove.i32
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep memmove.i32
; Instcombine was trying to turn this into a memmove.i32
target datalayout = "e-p:64:64"
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'and.*32' &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'or.*153'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep and.*32
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep or.*153
; PR1014
int %test(int %tmp1) {
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep sub &&
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep sub
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep add
<4 x float> %test(<4 x float> %tmp26, <4 x float> %tmp53) {
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep '%bothcond ='
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {%bothcond =}
bool %Doit_bb(int %i.0) {
bb: ; preds = %newFuncRoot
%tmp = setgt int %i.0, 0 ; <bool> [#uses=1]
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis|grep 'icmp sgt'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {icmp sgt}
+; END.
+
; ModuleID = 'visible.bc'
target datalayout = "e-p:32:32"
target endian = little
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep select
+; END.
target datalayout = "e-p:32:32"
target endian = little
target pointersize = 32
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep -v 'icmp ult int'
+; RUN: grep -v {icmp ult int}
+; END.
; ModuleID = 'good.bc'
target datalayout = "e-p:32:32"
target endian = little
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep 'icmp' | wc -l | grep 1
+; RUN: grep icmp | wc -l | grep 1
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep 'icmp ugt' | wc -l | grep 1
-;
+; RUN: grep {icmp ugt} | wc -l | grep 1
+; END.
+
; ModuleID = 'bugpoint-tooptimize.bc'
target datalayout = "e-p:32:32"
target endian = little
; For PR1065. This causes an assertion in instcombine if a select with two cmp
; operands is encountered.
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output
+; END.
; ModuleID = 'PR1065.bc'
target datalayout = "e-p:32:32"
target endian = little
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'fcmp uno.*0.0'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {fcmp uno.*0.0}
; PR1111
define i1 @test(double %X) {
%tmp = fcmp une double %X, %X
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep "ugt.*, 1"
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ugt.*, 1}
define i1 @test(i32 %tmp1030) {
%tmp1037 = icmp ne i32 %tmp1030, 40 ; <i1> [#uses=1]
-; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | grep '%A = alloca' &&
-; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | not grep '%B = alloca'
+; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | grep {%A = alloca}
+; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \
+; RUN: not grep {%B = alloca}
+; END.
; Ensure that instcombine doesn't sink the loads in entry/cond_true into
; cond_next. Doing so prevents mem2reg from promoting the B alloca.
-;RUN: llvm-upgrade < %s | llvm-as | opt -instcombine |llvm-dis |grep zext
+;RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep zext
-;Make sure the uint isn't removed.
-;instcombine in llvm 1.9 was dropping the uint cast which was causing a sign
-;extend
-;this only affected code with pointers in the high half of memory, so it wasn't
-;noticed much :)
-;compile a kernel though...
+; Make sure the uint isn't removed. Instcombine in llvm 1.9 was dropping the
+; uint cast which was causing a sign extend. This only affected code with
+; pointers in the high half of memory, so it wasn't noticed much
+; compile a kernel though...
target datalayout = "e-p:32:32"
target endian = little
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'icmp sle'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp sle}
; PR1244
define i1 @test(i32 %c.3.i, i32 %d.292.2.i) {
; For PR1248
-; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep 'ugt i32 .*, 11'
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep {ugt i32 .*, 11}
define i1 @test(i32 %tmp6) {
%tmp7 = sdiv i32 %tmp6, 12 ; <i32> [#uses=1]
icmp ne i32 %tmp7, -6 ; <i1>:1 [#uses=1]
; PR1271
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: grep 'icmp eq i32 .tmp.*, 2146435072'
+; RUN: grep {icmp eq i32 .tmp.*, 2146435072}
%struct..0anon = type { i32, i32 }
%struct..1anon = type { double }
; PR1271
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: grep 'ashr i32 %.mp137, 2'
+; RUN: grep {ashr i32 %.mp137, 2}
+; END.
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"
; is not done. It should be removed when code gen supports "funny"
; bit widths.
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'add i49.*-8388608'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i49.*-8388608}
define i49 @test5(i49 %x) {
;; If we have ADD(XOR(AND(X, 0xFF), 0x80), 0xF..F80), it's a sext.
; RUN: llvm-as < %s | opt -instcombine -disable-output
+; END.
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-apple-darwin8"
; 64-bit targets.
;
; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep '= add '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {= add }
target datalayout = "e-p:64:64:64-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 = "x86_64-unknown-freebsd6.2"
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep select | not grep 'int\*'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep select | not grep {i32\\*}
; This testcase corresponds to PR362, which notices that this horrible code
; is generated by the C++ front-end and LLVM optimizers, which has lots of
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -gcse -instcombine | llvm-dis | not grep getelementptr
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -gcse -instcombine | \
+; RUN: llvm-dis | not grep getelementptr
bool %test(int* %A) {
%B = getelementptr int* %A, int 1
; This is the sequence of stuff that the Java front-end expands for a single
; <= comparison. Check to make sure we turn it into a <= (only)
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'icmp sle'| not grep '#uses'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep -v {icmp sle} | not grep #uses
bool %le(int %A, int %B) {
%c1 = setgt int %A, %B;
; Zero byte allocas should be deleted.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep alloca
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep alloca
+; END.
declare void %use(...)
void %test() {
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep and | wc -l | grep 1
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep and | wc -l | grep 1
; Should be optimized to one and.
bool %test1(uint %a, uint %b) {
;
; Which corresponds to test1.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'or '
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {or }
int %test1(int %X, int %Y) {
%A = and int %X, 7
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | wc -l | grep 1 &&
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | wc -l | grep 1
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | wc -l | grep 2
; (x&z) ^ (y&z) -> (x^y)&z
; This test makes sure that add instructions are properly eliminated.
; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: grep -v OK | not grep add
; This test makes sure that add instructions are properly eliminated.
; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: grep -v OK | not grep add
;
; This tests arbitrary precision integers.
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'or '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {or }
define i17 @test1(i17 %X, i17 %Y) {
%A = and i17 %X, 7
; This test case checks that the merge of and/xor can work on arbitrary
; precision integers.
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | wc -l | grep 1 &&
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | wc -l | grep 1
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | wc -l | grep 2
; (x &z ) ^ (y & z) -> (x ^ y) & z
; This test makes sure that and instructions are properly eliminated.
; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'and '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and }
define i39 @test0(i39 %A) {
%B = and i39 %A, 0 ; zero result
; This test makes sure that and instructions are properly eliminated.
; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'and '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and }
define i999 @test0(i999 %A) {
; Tests to make sure elimination of casts is working correctly
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
define i17 @test1(i17 %a) {
; Test that elimination of logical operators works with
; arbitrary precision integers.
-
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: not grep '(and\|xor\|add\|shl\|shr)'
+; RUN: not grep {(and\|xor\|add\|shl\|shr)}
+; END.
define i33 @test1(i33 %x) {
%tmp.1 = and i33 %x, 65535 ; <i33> [#uses=1]
; This test makes sure that or instructions are properly eliminated.
; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
;
-
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis > /tmp/or2.rel &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or
; This test makes sure that these instructions are properly eliminated.
; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0.
;
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem
; This test makes sure that these instructions are properly eliminated.
; This test is for Integer BitWidth >= 64 && BitWidth <= 1024.
;
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem
; This test makes sure that these instructions are properly eliminated.
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select &&
-; RUN: llvm-as < %s | opt -instcombine -disable-output
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select
define i41 @test1(i1 %C) {
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: egrep 'shl|lshr|ashr' | wc -l | grep 3
+; RUN: egrep {shl|lshr|ashr} | wc -l | grep 3
define i41 @test0(i41 %A, i41 %B, i41 %C) {
%X = shl i41 %A, %C
; This test makes sure that shit instructions are properly eliminated
; even with arbitrary precision integers.
-
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sh
+; END.
define i47 @test1(i47 %A) {
%B = shl i47 %A, 0 ; <i47> [#uses=1]
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis > /tmp/sht.rel &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shl
+; END.
define i1 @test0(i39 %X, i39 %A) {
%B = lshr i39 %X, %A
; even with arbitrary precision integers.
;
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: grep -v 'sub i19 %Cok, %Bok' | not grep sub
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v {sub i19 %Cok, %Bok} | not grep sub
define i23 @test1(i23 %A) {
%B = sub i23 %A, %A ; <i23> [#uses=1]
; This test makes sure that xor instructions are properly eliminated.
; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor }
define i47 @test1(i47 %A, i47 %B) {
; This test makes sure that xor instructions are properly eliminated.
; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor }
define i447 @test1(i447 %A, i447 %B) {
; Tests to make sure elimination of casts is working correctly
; This test is for Integer BitWidth <= 64 && BitWidth % 2 != 0.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast '' '%c1.*'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast {} {%c1.*}
define i47 @test_sext_zext(i11 %A) {
%c1 = zext i11 %A to i39
; Tests to make sure elimination of casts is working correctly
; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast '' '%c1.*'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast {} {%c1.*}
define i1024 @test_sext_zext(i77 %A) {
%c1 = zext i77 %A to i533
; This file contains various testcases that require tracking whether bits are
; set or cleared by various instructions.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -instcombine | llvm-dis | not grep %ELIM
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -instcombine | llvm-dis |\
+; RUN: not grep %ELIM
; Reduce down to a single XOR
int %test3(int %B) {
; Tests to make sure bit counts of constants are folded
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'ret i32 19' &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v declare | not grep 'llvm.ct'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 19}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v declare | not grep llvm.ct
declare i32 @llvm.ctpop.i31(i31 %val)
declare i32 @llvm.cttz.i32(i32 %val)
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -simplifycfg -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -simplifycfg | llvm-dis | not grep 'call void %abort'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -simplifycfg | llvm-dis |\
+; RUN: not grep {call void %abort}
%b_rec.0 = external global int
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep ret | wc -l | grep 3 &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'call.*bswap'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep ret | wc -l | grep 3
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep call.*bswap
bool %test1(ushort %tmp2) {
%tmp10 = call ushort %llvm.bswap.i16( ushort %tmp2 )
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'call.*llvm.bswap' | wc -l | grep 5
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {call.*llvm.bswap} | wc -l | grep 5
uint %test1(uint %i) {
%tmp1 = shr uint %i, ubyte 24 ; <uint> [#uses=1]
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep call | not grep bitcast
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep call | not grep bitcast
target endian = little
target pointersize = 32
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep call | notcast
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep call | notcast
implementation
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'setne\|setle\|setge'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {setne\|setle\|setge}
int %test1(uint %X, uint %Y) {
%C = setne uint %X, %Y
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep bitcast
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep bitcast
bool %test1(uint %val) {
%t1 = bitcast uint %val to int
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep ubyte
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep ubyte
int %test1(uint %X) {
%Y = cast uint %X to ubyte ;; Turn into an AND
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -globaldce | llvm-dis | not grep Array
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -globaldce | llvm-dis | \
+; RUN: not grep Array
; Pulling the cast out of the load allows us to eliminate the load, and then
; the whole array.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg | llvm-dis | not grep load
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg | llvm-dis | \
+; RUN: not grep load
int %test1(uint* %P) {
%A = alloca uint
; Tests to make sure elimination of casts is working correctly
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep '%c' | notcast
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep %c | notcast
%inbuf = external global [32832 x ubyte]
; Tests to make sure elimination of casts is working correctly
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
define i16 @test1(i16 %a) {
; Tests to make sure elimination of casts is working correctly
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | notcast
; XFAIL: *
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'ret i32 %A'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {ret i32 %A}
int %test(int %A) {
%X = or bool false, false
-load_lib llvm-dg.exp
+load_lib llvm.exp
llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep getelementptr
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep getelementptr
bool %test1(short* %P, int %I, int %J) {
%X = getelementptr short* %P, int %I
; The %A getelementptr instruction should be eliminated here
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v '%B' | not grep getelementptr &&
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep -v %B | not grep getelementptr
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep foo1
%Global = constant [10 x sbyte] c"helloworld"
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | notcast '' 'getelementptr.*'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: notcast {} {getelementptr.*}
+
%G = external global [3 x sbyte]
implementation
; Test folding of constantexpr geps into normal geps.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -gcse -instcombine | llvm-dis | not grep getelementptr
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -gcse -instcombine | \
+; RUN: llvm-dis | not grep getelementptr
%Array = external global [40 x int]
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | %prcontext div 1 | grep then:
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: %prcontext div 1 | grep then:
;; This tests that the div is hoisted into the then block.
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep icmp
+; END.
define i32 @test1(i32 %X) {
entry:
; This test makes sure that these instructions are properly eliminated.
;
-
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep load
+; END.
%X = constant int 42
%X2 = constant int 47
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'ret i32 0' &&
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0}
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep malloc
; PR1201
define i32 @main(i32 %argc, i8** %argv) {
free i8* %tmp_207
ret i32 0
}
-
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'ret i32 0' &&
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0}
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep malloc
; PR1313
; This test makes sure that memmove instructions are properly eliminated.
;
-
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'call void %llvm.memmove'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {call void @llvm.memmove}
%S = internal constant [33 x sbyte] c"panic: restorelist inconsistency\00"
; This test makes sure that mul instructions are properly eliminated.
;
-
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep mul
implementation
; This file contains various testcases that check to see that instcombine
; is narrowing computations when possible.
-
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep 'ret i1 false'
+; RUN: grep {ret i1 false}
; test1 - Eliminating the casts in this testcase (by narrowing the AND
; operation) allows instcombine to realize the function always returns false.
; This test makes sure that these instructions are properly eliminated.
;
-
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v xor | not grep 'or '
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep -v xor | not grep {or }
implementation
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ' or'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep { or}
define i32 @test1(i32 %b, i32 %c, i32 %d) {
%tmp3 = and i32 %c, %b
; This test makes sure that these instructions are properly eliminated.
;
-
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep phi
implementation
; This test makes sure that these instructions are properly eliminated.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep rem
implementation
; This test makes sure that these instructions are properly eliminated.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep select &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep select
implementation
; This test makes sure that these instructions are properly eliminated.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep icmp
+; END.
%X = uninitialized global int
; This test case was reduced from MultiSource/Applications/hbd. It makes sure
; that folding doesn't happen in case a zext is applied where a sext should have
; been when a setcc is used with two casts.
-; RUN: llvm-upgrade < %s | llvm-as | llc -instcombine | llvm-dis | not grep 'br bool false'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {br bool false}
+; END.
+
int %bug(ubyte %inbuff) {
entry:
%tmp = bitcast ubyte %inbuff to sbyte ; <sbyte> [#uses=1]
; working. Basically this boils down to converting setlt,gt,le,ge instructions
; into equivalent setne,eq instructions.
;
-
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'icmp eq' | grep -v 'icmp ne' | not grep icmp
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep -v {icmp eq} | grep -v {icmp ne} | not grep icmp
+; END.
bool %test1(uint %A) {
%B = setge uint %A, 1 ; setne %A, 0
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: egrep 'shl|lshr|ashr' | wc -l | grep 3
+; RUN: egrep {shl|lshr|ashr} | wc -l | grep 3
define i32 @test0(i32 %A, i32 %B, i32 %C) {
%X = shl i32 %A, %C
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep 'lshr i32' | wc -l | grep 2 &&
+; RUN: grep {lshr i32} | wc -l | grep 2
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep ashr
int %test1(int %X, ubyte %A) {
; This test makes sure that these instructions are properly eliminated.
;
-
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep sh
+; END.
implementation
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: not grep '(and\|xor\|add\|shl\|shr)'
+; RUN: not grep {(and\|xor\|add\|shl\|shr)}
int %test1(int %x) {
%tmp.1 = and int %x, 65535 ; <int> [#uses=1]
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | %prcontext div 1 | grep ret
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: %prcontext div 1 | grep ret
;; This tests that the instructions in the entry blocks are sunk into each
;; arm of the 'if'.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep call
;; Test that llvm.stackrestore is removed when possible.
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'store.*,.*null' | not grep store
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep -v {store.*,.*null} | not grep store
void %test1(int* %P) {
store int undef, int* %P
; This test makes sure that these instructions are properly eliminated.
;
-
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep -v 'sub i32 %Cok, %Bok' | not grep sub
+; RUN: grep -v {sub i32 %Cok, %Bok} | not grep sub
implementation
-; This tests that this transform:
+; Test that this transform works:
; udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2)
;
-; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis -f -o %t && \
-; RUN: grep select %t | wc -l | grep 1 && \
-; RUN: grep lshr %t | wc -l | grep 2 && \
-; RUN: grep udiv %t | wc -l | grep 0
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis -f -o %t
+; RUN: grep select %t | wc -l | grep 1
+; RUN: grep lshr %t | wc -l | grep 2
+; RUN: ignore grep udiv %t | wc -l | grep 0
define i64 @test(i64 %X, i1 %Cond ) {
entry:
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'sub float' &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'mul float' &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'insertelement.*0.00' &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'call.*llvm.x86.sse.mul' &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'call.*llvm.x86.sse.sub'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {sub float}
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {mul float}
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {insertelement.*0.00}
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {call.*llvm.x86.sse.mul}
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {call.*llvm.x86.sse.sub}
+; END.
ushort %Convert_sse(float %f) {
entry:
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep shufflevec | wc -l | grep 1 &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep insertelement &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep extractelement
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep shufflevec | wc -l | grep 1
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep insertelement
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep extractelement
<4 x float> %test(<4 x float> %tmp, <4 x float> %tmp1) {
%tmp4 = extractelement <4 x float> %tmp, uint 1 ; <float> [#uses=1]
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'ret <4 x i32> %A'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret <4 x i32> %A}
; PR1286
define <4 x i32> @test1(<4 x i32> %A) {
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'add float'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep {add float}
%V = type <4 x float>
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep vector_shuffle
%T = type <4 x float>
; This test makes sure that these instructions are properly eliminated.
;
-
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 'xor '
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: not grep {xor }
+; END.
%G1 = global uint 0
%G2 = global uint 0
; This test makes sure that these instructions are properly eliminated.
;
-
-; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor }
; PR1253
define i1 @test0(i32 %A) {
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN: grep 'and i32 %Y, 8'
+; RUN: grep {and i32 %Y, 8}
int %test1(ubyte %X) {
%Y = cast ubyte %X to int
; Tests to make sure elimination of casts is working correctly
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | notcast '' '%c1.*'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: notcast {} {%c1.*}
long %test_sext_zext(short %A) {
%c1 = zext short %A to uint