llvm.org GIT mirror llvm / 3e054fe
Use opt -S instead of piping bitcode output through llvm-dis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81257 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
865 changed file(s) with 973 addition(s) and 973 deletion(s). Raw diff Collapse all Expand all
None ; RUN: opt %s -anders-aa -gvn | llvm-dis | not grep undef
0 ; RUN: opt %s -anders-aa -gvn -S | not grep undef
11 ; PR2160
22
33 declare void @f(i32*)
None ; RUN: opt %s -anders-aa -gvn | llvm-dis | not grep undef
0 ; RUN: opt %s -anders-aa -gvn -S | not grep undef
11 ; PR2169
22
33 declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
None ; RUN: opt %s -anders-aa -gvn -deadargelim | llvm-dis | grep store | not grep null
0 ; RUN: opt %s -anders-aa -gvn -deadargelim -S | grep store | not grep null
11
22 ; Because the 'internal' function is passed to an external function, we don't
33 ; know what the incoming values will alias. As such, we cannot do the
11 ; is performed. It is not legal to delete the second load instruction because
22 ; the value computed by the first load instruction is changed by the store.
33
4 ; RUN: opt %s -gvn -instcombine | llvm-dis | grep DONOTREMOVE
4 ; RUN: opt %s -gvn -instcombine -S | grep DONOTREMOVE
55
66 define i32 @test() {
77 %A = alloca i32
None ; RUN: opt %s -gvn -instcombine | llvm-dis | grep sub
0 ; RUN: opt %s -gvn -instcombine -S | grep sub
11
22 ; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
33
0 ; In this test, a local alloca cannot alias an incoming argument.
11
2 ; RUN: opt %s -gvn -instcombine | llvm-dis | not grep sub
2 ; RUN: opt %s -gvn -instcombine -S | not grep sub
33
44 define i32 @test(i32* %P) {
55 %X = alloca i32
None ; RUN: opt %s -dse | llvm-dis | grep {store i32 0}
0 ; RUN: opt %s -dse -S | grep {store i32 0}
11
22 define void @test({i32,i32 }* %P) {
33 %Q = getelementptr {i32,i32}* %P, i32 1
0 ; PR1109
1 ; RUN: opt %s -basicaa -gvn -instcombine | llvm-dis | \
1 ; RUN: opt %s -basicaa -gvn -instcombine -S | \
22 ; RUN: grep {sub i32}
3 ; RUN: opt %s -basicaa -gvn -instcombine | llvm-dis | \
3 ; RUN: opt %s -basicaa -gvn -instcombine -S | \
44 ; RUN: not grep {ret i32 0}
55 ; END.
66
0 ; PR1600
1 ; RUN: opt %s -basicaa -gvn -instcombine | llvm-dis | \
1 ; RUN: opt %s -basicaa -gvn -instcombine -S | \
22 ; RUN: grep {ret i32 0}
33 ; END.
44
None ; RUN: opt %s -basicaa -gvn -dce | llvm-dis | grep tmp7
0 ; RUN: opt %s -basicaa -gvn -dce -S | grep tmp7
11
22 %struct.A = type { i32 }
33 %struct.B = type { %struct.A }
None ; RUN: opt %s -std-compile-opts | llvm-dis | grep store
0 ; RUN: opt %s -std-compile-opts -S | grep store
11 ; ModuleID = 'small2.c'
22 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-f80:128:128"
33 target triple = "i386-apple-darwin8"
None ; RUN: opt %s -basicaa -gvn | llvm-dis | grep load
0 ; RUN: opt %s -basicaa -gvn -S | grep load
11
22 declare noalias i32* @noalias()
33
None ; RUN: opt %s -gvn | llvm-dis | grep {ret i32 1}
0 ; RUN: opt %s -gvn -S | grep {ret i32 1}
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-f80:128:128"
22 target triple = "i686-apple-darwin8"
33 %struct.x = type { i32, i32, i32, i32 }
None ; RUN: opt %s -basicaa -gvn | llvm-dis | grep load | count 1
0 ; RUN: opt %s -basicaa -gvn -S | grep load | count 1
11
22 @flag0 = internal global i32 zeroinitializer
33 @turn = internal global i32 zeroinitializer
0 ; This testcase tests for various features the basicaa test should be able to
11 ; determine, as noted in the comments.
22
3 ; RUN: opt %s -basicaa -gvn -instcombine -dce | llvm-dis | not grep REMOVE
3 ; RUN: opt %s -basicaa -gvn -instcombine -dce -S | not grep REMOVE
44
55 @Global = external global { i32 }
66
0 ; A store or load cannot alias a global if the accessed amount is larger then
11 ; the global.
22
3 ; RUN: opt %s -basicaa -gvn -instcombine | llvm-dis | not grep load
3 ; RUN: opt %s -basicaa -gvn -instcombine -S | not grep load
44
55 @B = global i16 8 ; [#uses=2]
66
None ; RUN: opt %s -basicaa -gvn -instcombine | llvm-dis | grep {ret i1 true}
0 ; RUN: opt %s -basicaa -gvn -instcombine -S | grep {ret i1 true}
11 ; PR2436
22 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-f80:128:128"
33 target triple = "i386-apple-darwin8"
None ; RUN: opt %s -basicaa -gvn -instcombine | llvm-dis | grep {ret i32 0}
0 ; RUN: opt %s -basicaa -gvn -instcombine -S | grep {ret i32 0}
11
22 declare i32* @test(i32* nocapture)
33
None ; RUN: opt %s -basicaa -gvn | llvm-dis | grep TestConst | count 2
1 ; RUN: opt %s -basicaa -gvn | llvm-dis | grep TestPure | count 3
2 ; RUN: opt %s -basicaa -gvn | llvm-dis | grep TestNone | count 4
0 ; RUN: opt %s -basicaa -gvn -S | grep TestConst | count 2
1 ; RUN: opt %s -basicaa -gvn -S | grep TestPure | count 3
2 ; RUN: opt %s -basicaa -gvn -S | grep TestNone | count 4
33 @g = global i32 0 ; [#uses=1]
44
55 define i32 @test() {
11 ; disambiguating some obvious cases. If LICM is able to disambiguate the
22 ; two pointers, then the load should be hoisted, and the store sunk.
33
4 ; RUN: opt %s -basicaa -licm | llvm-dis | FileCheck %s
4 ; RUN: opt %s -basicaa -licm -S | FileCheck %s
55
66 @A = global i32 7 ; [#uses=3]
77 @B = global i32 8 ; [#uses=2]
None ; RUN: opt %s -globalsmodref-aa -gvn | llvm-dis | grep call | count 2
0 ; RUN: opt %s -globalsmodref-aa -gvn -S | grep call | count 2
11
22 @g = internal global i32 0 ; [#uses=2]
33
None ; RUN: opt %s -globalsmodref-aa -gvn | llvm-dis | not grep load
0 ; RUN: opt %s -globalsmodref-aa -gvn -S | not grep load
11 @X = internal global i32 4 ; [#uses=1]
22
33 define i32 @test(i32* %P) {
None ; RUN: opt %s -globalsmodref-aa -gvn | llvm-dis | not grep load
0 ; RUN: opt %s -globalsmodref-aa -gvn -S | not grep load
11
22 ; This test requires the use of previous analyses to determine that
33 ; doesnotmodX does not modify X (because 'sin' doesn't).
None ; RUN: opt %s -globalsmodref-aa -gvn -instcombine | llvm-dis | \
0 ; RUN: opt %s -globalsmodref-aa -gvn -instcombine -S | \
11 ; RUN: grep {ret i32 0}
22
33 @G = internal global i32* null ; [#uses=3]
None ; RUN: opt %s -globalsmodref-aa -gvn | llvm-dis | not grep load
0 ; RUN: opt %s -globalsmodref-aa -gvn -S | not grep load
11 @X = internal global i32 4 ; [#uses=2]
22
33 define i32 @test(i32* %P) {
0 ; Test the edge profiling instrumentation.
1 ; RUN: opt %s -insert-edge-profiling | llvm-dis | FileCheck %s
1 ; RUN: opt %s -insert-edge-profiling -S | FileCheck %s
22
33 ; ModuleID = ''
44
None ; RUN: opt %s -indvars -adce -simplifycfg | llvm-dis | grep "icmp s"
0 ; RUN: opt %s -indvars -adce -simplifycfg -S | grep "icmp s"
11 ; PR1598
22
33 define i32 @f(i32 %a, i32 %b, i32 %x, i32 %y) {
None ; RUN: opt %s -indvars | llvm-dis | grep printd | grep 1206807378
0 ; RUN: opt %s -indvars -S | grep printd | grep 1206807378
11 ; PR1798
22
33 declare void @printd(i32)
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep select %t | count 2
22 ; RUN: grep {icmp ne i32.\* %w } %t
33
44 ; of the bug that was causing the Olden Health benchmark to output incorrect
55 ; results!
66 ;
7 ; RUN: opt %s -constprop | llvm-dis > %t.1
7 ; RUN: opt -constprop -S > %t.1 < %s
88 ; RUN: llvm-as < %s | llvm-dis | llvm-as | opt -constprop | \
99 ; RUN: llvm-dis > %t.2
1010 ; RUN: diff %t.1 %t.2
33 ; Check by running globaldce, which will remove the constant if there are
44 ; no references to it!
55 ;
6 ; RUN: opt %s -globaldce | llvm-dis | \
6 ; RUN: opt %s -globaldce -S | \
77 ; RUN: not grep constant
88 ;
99
0 ; Testcase that seems to break the bytecode reader. This comes from the
11 ; "crafty" spec benchmark.
22 ;
3 ; RUN: opt %s -instcombine | llvm-dis | llvm-as
3 ; RUN: opt %s -instcombine -S | llvm-as
44
55 %CHESS_POSITION = type { i32, i32 }
66 @pawn_probes = external global i32 ; [#uses=0]
None ; RUN: opt %s -instcombine -simplifycfg | llvm-dis | not grep br
0 ; RUN: opt %s -instcombine -simplifycfg -S | not grep br
11
22 @.str_1 = internal constant [6 x i8] c"_Bool\00" ; <[6 x i8]*> [#uses=2]
33
None ; RUN: opt %s -verify | llvm-dis | llvm-as -disable-output
0 ; RUN: opt %s -verify -S | llvm-as -disable-output
11
22 define {i32, i8} @foo(i32 %p) {
33 ret i32 1, i8 2
None ; RUN: opt %s -strip | llvm-dis | llvm-as | llvm-dis
0 ; RUN: opt %s -strip -S | llvm-as | llvm-dis
11
22 ; Stripping the name from A should not break references to it.
33 %A = type opaque
None ; RUN: opt %s -inline | llvm-dis | grep example
0 ; RUN: opt %s -inline -S | grep example
11
22 %IntArray = type { i32, [0 x i32*] }
33
None ; RUN: opt %s -inline | llvm-dis | grep sample
1 ; RUN: opt %s -inline | llvm-dis | grep example
0 ; RUN: opt %s -inline -S | grep sample
1 ; RUN: opt %s -inline -S | grep example
22
33 %IntArray = type { i32, [0 x i32*] }
44
None ; RUN: opt %s -instcombine | llvm-dis | grep 302245289961712575840256
1 ; RUN: opt %s -instcombine | llvm-dis | grep K40018000000000000000
0 ; RUN: opt %s -instcombine -S | grep 302245289961712575840256
1 ; RUN: opt %s -instcombine -S | grep K40018000000000000000
22 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-f80:128:128"
33 target triple = "i686-apple-darwin9"
44
None ;RUN: llvm-as <%s | opt -licm | llvm-dis | grep {load } | count 4
0 ;RUN: llvm-as <%s | opt -licm -S | grep {load } | count 4
11 ; ModuleID = '2009-02-27-licm.bc'
22 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-f80:32:32"
33 target triple = "i386-pc-linux-gnu"
None ; RUN: opt %s -instcombine | llvm-dis | grep store | count 5
0 ; RUN: opt %s -instcombine -S | grep store | count 5
11 ; ModuleID = ''
22 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-f80:128:128"
33 target triple = "i386-apple-darwin9.6"
None ; RUN: opt %s -instcombine | llvm-dis | not grep alloca
0 ; RUN: opt %s -instcombine -S | not grep alloca
11 ; ModuleID = ''
22 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-f80:128:128"
33 target triple = "i386-apple-darwin9.6"
None ; RUN: opt %s -instcombine | llvm-dis | not grep alloca
0 ; RUN: opt %s -instcombine -S | not grep alloca
11 ; ModuleID = ''
22 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-f80:128:128"
33 target triple = "i386-apple-darwin9.6"
None ;RUN: llvm-as <%s | opt -gvn | llvm-dis | grep {load } | count 1
0 ;RUN: llvm-as <%s | opt -gvn -S | grep {load } | count 1
11 ; ModuleID = 'db2-before.bc'
22 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-f80:32:32"
33 target triple = "i386-pc-linux-gnu"
None ; RUN: opt %s -std-compile-opts | llvm-dis > %t
0 ; RUN: opt %s -std-compile-opts -S > %t
11 ; RUN: grep undef %t | count 1
22 ; RUN: grep 5 %t | count 1
33 ; RUN: grep 7 %t | count 1
None ; RUN: opt %s -instcombine | llvm-dis | grep true
0 ; RUN: opt %s -instcombine -S | grep true
11
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"
33 target triple = "x86_64-unknown-linux-gnu"
0
1 ; RUN: opt %s -verify | llvm-dis | grep noimplicitfloat
1 ; RUN: opt %s -verify -S | grep noimplicitfloat
22 define void @f() noimplicitfloat {
33 }
0 ; It is illegal to remove BB1 because it will mess up the PHI node!
11 ;
2 ; RUN: opt %s -adce | llvm-dis | grep BB1
2 ; RUN: opt %s -adce -S | grep BB1
33
44 define i32 @test(i1 %C, i32 %A, i32 %B) {
55 ;
None ; RUN: opt %s -adce -simplifycfg | llvm-dis | not grep then:
0 ; RUN: opt %s -adce -simplifycfg -S | not grep then:
11
22 define void @dead_test8(i32* %data.1, i32 %idx.1) {
33 entry:
None ; RUN: opt %s -adce -simplifycfg | llvm-dis | grep call
0 ; RUN: opt %s -adce -simplifycfg -S | grep call
11 declare void @exit(i32)
22
33 define i32 @main(i32 %argc) {
None ; RUN: opt %s -adce | llvm-dis | not grep call
0 ; RUN: opt -adce -S < %s | not grep call
11
22 declare i32 @strlen(i8*) readonly nounwind
33
None ; RUN: opt %s -adce | llvm-dis | grep null
0 ; RUN: opt %s -adce -S | grep null
11
22 declare i32 @strlen(i8*) readnone
33
None ; RUN: opt %s -argpromotion | llvm-dis | grep nounwind | count 2
0 ; RUN: opt %s -argpromotion -S | grep nounwind | count 2
11
22 define internal i32 @deref(i32* %x) nounwind {
33 entry:
None ; RUN: opt %s -argpromotion | llvm-dis > %t
0 ; RUN: opt %s -argpromotion -S > %t
11 ; RUN: cat %t | grep {define.*@callee(.*i32\\*}
22 ; PR2498
33
None ; RUN: opt %s -argpromotion -instcombine | llvm-dis | not grep load
0 ; RUN: opt %s -argpromotion -instcombine -S | not grep load
11
22 %QuadTy = type { i32, i32, i32, i32 }
33 @G = constant %QuadTy {
None ; RUN: opt %s -argpromotion | llvm-dis | grep zeroext
0 ; RUN: opt %s -argpromotion -S | grep zeroext
11
22 %struct.ss = type { i32, i64 }
33
None ; RUN: opt %s -argpromotion -mem2reg | llvm-dis | not grep alloca
0 ; RUN: opt %s -argpromotion -mem2reg -S | not grep alloca
11 define internal i32 @test(i32* %X, i32* %Y) {
22 %A = load i32* %X ; [#uses=1]
33 %B = load i32* %Y ; [#uses=1]
None ; RUN: opt %s -argpromotion | llvm-dis | grep -F {i32* byval} | count 2
0 ; RUN: opt %s -argpromotion -S | grep -F {i32* byval} | count 2
11 ; Argpromote + scalarrepl should change this to passing the two integers by value.
22
33 %struct.ss = type { i32, i64 }
None ; RUN: opt %s -argpromotion -scalarrepl | llvm-dis | not grep load
0 ; RUN: opt %s -argpromotion -scalarrepl -S | not grep load
11 ; Argpromote + scalarrepl should change this to passing the two integers by value.
22
33 %struct.ss = type { i32, i64 }
None ; RUN: opt %s -argpromotion -instcombine | llvm-dis | not grep load
0 ; RUN: opt %s -argpromotion -instcombine -S | not grep load
11
22 @G1 = constant i32 0 ; [#uses=1]
33 @G2 = constant i32* @G1 ; [#uses=1]
None ; RUN: opt %s -argpromotion | llvm-dis | \
0 ; RUN: opt %s -argpromotion -S | \
11 ; RUN: not grep {load i32\* null}
22
33 define internal i32 @callee(i1 %C, i32* %P) {
None ; RUN: opt %s -argpromotion | llvm-dis | \
0 ; RUN: opt %s -argpromotion -S | \
11 ; RUN: grep {load i32\\* %A}
22
33 define internal i32 @callee(i1 %C, i32* %P) {
None ; RUN: opt %s -condprop | llvm-dis | \
0 ; RUN: opt %s -condprop -S | \
11 ; RUN: not grep {br label}
22
33 %llvm.dbg.anchor.type = type { i32, i32 }
None ; RUN: opt %s -condprop | llvm-dis | \
0 ; RUN: opt %s -condprop -S | \
11 ; RUN: not grep {br label}
2 ; RUN: opt %s -condprop | llvm-dis | not grep T2
2 ; RUN: opt %s -condprop -S | not grep T2
33
44
55 define i32 @test(i1 %C) {
None ; RUN: opt %s -condprop | llvm-dis | not grep phi
0 ; RUN: opt < %s -condprop -S | not grep phi
11
22 define i32 @test(i32 %C, i1 %Val) {
33 switch i32 %C, label %T1 [
None ; RUN: opt %s -condprop | llvm-dis | not grep phi
0 ; RUN: opt < %s -condprop -S | not grep phi
11
22 declare i1 @foo()
33
None ; RUN: opt %s -condprop | llvm-dis | not grep phi
0 ; RUN: opt < %s -condprop -S | not grep phi
11
22 define i32 @foo(i1, i32, i32) {
33 prologue:
33
44 ; Fix #2: The unary not instruction now no longer exists. Change to xor.
55
6 ; RUN: opt %s -constprop | llvm-dis | \
6 ; RUN: opt %s -constprop -S | \
77 ; RUN: not grep {i32 0}
88
99 define i32 @test1() {
0 ; SetCC on boolean values was not implemented!
11
2 ; RUN: opt %s -constprop -die | llvm-dis | \
2 ; RUN: opt %s -constprop -die -S | \
33 ; RUN: not grep set
44
55 define i1 @test1() {
None ; RUN: opt %s -constprop | llvm-dis | \
0 ; RUN: opt %s -constprop -S | \
11 ; RUN: not grep {ret i1 false}
22
33 @b = external global [2 x { }] ; <[2 x { }]*> [#uses=2]
None ; RUN: opt %s -constprop | llvm-dis | \
0 ; RUN: opt %s -constprop -S | \
11 ; RUN: grep {i32 -1}
2 ; RUN: opt %s -constprop | llvm-dis | \
2 ; RUN: opt %s -constprop -S | \
33 ; RUN: not grep zeroinitializer
44
55 define <4 x i32> @test() {
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: grep {ret i1 false}
22 define i1 @test() {
33 %X = trunc i32 320 to i1 ; [#uses=1]
None ; RUN: opt %s -constprop | llvm-dis | \
0 ; RUN: opt %s -constprop -S | \
11 ; RUN: grep {ret i32 -1}
2 ; RUN: opt %s -constprop | llvm-dis | \
2 ; RUN: opt %s -constprop -S | \
33 ; RUN: grep {ret i32 1}
44
55 define i32 @test1() {
None ; RUN: opt %s -constprop | llvm-dis | grep 1065353216
0 ; RUN: opt %s -constprop -S | grep 1065353216
11
22 define i32 @test() {
33 %A = bitcast float 1.000000e+00 to i32 ; [#uses=1]
None ; RUN: opt %s -constprop | llvm-dis | grep {ret i13 13}
0 ; RUN: opt %s -constprop -S | grep {ret i13 13}
11 ; PR1816
22 declare i13 @llvm.cttz.i13(i13)
33
0 ; This is a basic sanity check for constant propogation. The add instruction
11 ; should be eliminated.
22
3 ; RUN: opt %s -constprop -die | llvm-dis | not grep add
3 ; RUN: opt %s -constprop -die -S | not grep add
44
55 define i32 @test(i1 %B) {
66 br i1 %B, label %BB1, label %BB2
None ; RUN: opt %s -instcombine | llvm-dis | not grep bitcast
0 ; RUN: opt < %s -instcombine -S | not grep bitcast
11 ; PR2165
22
33 define <1 x i64> @test() {
0 ; bswap should be constant folded when it is passed a constant argument
11
2 ; RUN: opt %s -constprop | llvm-dis | not grep call
2 ; RUN: opt %s -constprop -S | not grep call
33
44 declare i16 @llvm.bswap.i16(i16)
55
None ; RUN: opt %s -constprop | llvm-dis | not grep call
0 ; RUN: opt < %s -constprop -S | not grep call
11
22 declare double @cos(double)
33
None ; RUN: opt %s -instcombine | llvm-dis | grep {ret i32 0}
0 ; RUN: opt %s -instcombine -S | grep {ret i32 0}
11 ; PR4424
22 declare void @ext()
33
None ; RUN: opt %s -constprop | llvm-dis | \
0 ; RUN: opt %s -constprop -S | \
11 ; RUN: grep -F {ret i32* null} | count 2
22
33 define i32* @test1() {
0 ; Ensure constant propogation of logical instructions is working correctly.
11
2 ; RUN: opt %s -constprop -die | llvm-dis | \
2 ; RUN: opt < %s -constprop -die -S | \
33 ; RUN: not egrep {and|or|xor}
44
55 define i32 @test1() {
0 ; Ensure constant propogation of 'not' instructions is working correctly.
11
2 ; RUN: opt %s -constprop -die | llvm-dis | not grep xor
2 ; RUN: opt %s -constprop -die -S | not grep xor
33
44 define i32 @test1() {
55 %R = xor i32 4, -1 ; [#uses=1]
0 ; This is a basic sanity check for constant propogation. The add instruction
11 ; should be eliminated.
22
3 ; RUN: opt %s -constprop -die | llvm-dis | not grep phi
3 ; RUN: opt < %s -constprop -die -S | not grep phi
44
55 define i32 @test(i1 %B) {
66 BB0:
0 ; Ensure constant propagation of remainder instructions is working correctly.
11
2 ; RUN: opt %s -constprop -die | llvm-dis | not grep rem
2 ; RUN: opt < %s -constprop -die -S | not grep rem
33
44 define i32 @test1() {
55 %R = srem i32 4, 3 ; [#uses=1]
None ; RUN: opt %s -constmerge | llvm-dis | grep foo
1 ; RUN: opt %s -constmerge | llvm-dis | grep bar
0 ; RUN: opt %s -constmerge -S | grep foo
1 ; RUN: opt %s -constmerge -S | grep bar
22
33 ; Don't merge constants in different sections.
44
None ; RUN: opt %s -deadargelim | llvm-dis | grep {@test(}
1 ; RUN: opt %s -deadargelim | llvm-dis | not grep dead
0 ; RUN: opt %s -deadargelim -S | grep {@test(}
1 ; RUN: opt %s -deadargelim -S | not grep dead
22
33 define internal i32 @test(i32 %X, i32 %dead) {
44 ret i32 %X
None ; RUN: opt %s -deadargelim | llvm-dis | not grep {ret i32 0}
0 ; RUN: opt %s -deadargelim -S | not grep {ret i32 0}
11 ; PR1735
22
33 define internal i32 @test(i32 %A, ...) {
None ; RUN: opt %s -deadargelim | llvm-dis > %t
0 ; RUN: opt %s -deadargelim -S > %t
11 ; RUN: cat %t | grep nounwind | count 2
22 ; RUN: cat %t | grep signext | count 2
33 ; RUN: cat %t | not grep inreg
None ; RUN: opt %s -deadargelim | llvm-dis | grep byval
0 ; RUN: opt %s -deadargelim -S | grep byval
11
22 %struct.point = type { double, double }
33 @pts = global [4 x %struct.point] [ %struct.point { double 1.000000e+00, double 2.000000e+00 }, %struct.point { double 3.000000e+00, double 4.000000e+00 }, %struct.point { double 5.000000e+00, double 6.000000e+00 }, %struct.point { double 7.000000e+00, double 8.000000e+00 } ], align 32 ; <[4 x %struct.point]*> [#uses=1]
None ; RUN: opt %s -deadargelim -die | llvm-dis > %t
0 ; RUN: opt %s -deadargelim -die -S > %t
11 ; RUN: cat %t | grep 123
22
33 ; This test tries to catch wrongful removal of return values for a specific case
None ; RUN: opt %s -deadargelim | llvm-dis | not grep DEADARG
0 ; RUN: opt %s -deadargelim -S | not grep DEADARG
11
22 ; test - an obviously dead argument
33 define internal i32 @test(i32 %v, i32 %DEADARG1, i32* %p) {
0 ; This test shows a few canonicalizations made by deadargelim
1 ; RUN: opt %s -deadargelim | llvm-dis > %t
1 ; RUN: opt %s -deadargelim -S > %t
22 ; This test should remove {} and replace it with void
33 ; RUN: cat %t | grep {define internal void @test}
44 ; This test shouls replace the {i32} return value with just i32
None ; RUN: opt %s -deadargelim | llvm-dis | not grep 47
1 ; RUN: opt %s -deadargelim | llvm-dis | not grep 1.0
0 ; RUN: opt %s -deadargelim -S | not grep 47
1 ; RUN: opt %s -deadargelim -S | not grep 1.0
22
33 define i32 @bar(i32 %A) {
44 %tmp4 = tail call i32 (i32, ...)* @foo( i32 %A, i32 %A, i32 %A, i32 %A, i64 47, double 1.000000e+00 ) ; [#uses=1]
None ; RUN: opt %s -deadargelim | llvm-dis | not grep DEAD
0 ; RUN: opt %s -deadargelim -S | not grep DEAD
11
22 ; Dead arg only used by dead retval
33 define internal i32 @test(i32 %DEADARG) {
None ; RUN: opt %s -deadargelim -die | llvm-dis > %t
0 ; RUN: opt %s -deadargelim -die -S > %t
11 ; RUN: cat %t | not grep DEAD
22 ; RUN: cat %t | grep LIVE | count 4
33
None ; RUN: opt %s -deadargelim | llvm-dis > %t
0 ; RUN: opt %s -deadargelim -S > %t
11 ; RUN: grep {define internal zeroext i32 @test1() nounwind} %t
22 ; RUN: grep {define internal %Ty @test2} %t
33
11 ; are unused. All unused values are typed i16, so we can easily check. We also
22 ; run instcombine to fold insert/extractvalue chains and we run dce to clean up
33 ; any remaining dead stuff.
4 ; RUN: opt %s -deadargelim -instcombine -dce | llvm-dis | not grep i16
4 ; RUN: opt %s -deadargelim -instcombine -dce -S | not grep i16
55
66 define internal {i16, i32} @test(i16 %DEADARG) {
77 %A = insertvalue {i16,i32} undef, i16 1, 0
None ; RUN: opt %s -dse | llvm-dis | \
0 ; RUN: opt %s -dse -S | \
11 ; RUN: grep {store i32 1234567}
22
33 ; Do not delete stores that are only partially killed.
None ; RUN: opt %s -dse | llvm-dis | grep store
0 ; RUN: opt %s -dse -S | grep store
11
22 define double @foo(i8* %X) {
33 %X_addr = alloca i8* ; [#uses=2]
None ; RUN: opt %s -dse | llvm-dis | not grep tmp5
0 ; RUN: opt %s -dse -S | not grep tmp5
11 ; PR2599
22
33 define void @foo({ i32, i32 }* %x) nounwind {
None ; RUN: opt %s -dse | llvm-dis | \
0 ; RUN: opt %s -dse -S | \
11 ; RUN: not grep {store i8}
22 ; Ensure that the dead store is deleted in this case. It is wholely
33 ; overwritten by the second store.
None ; RUN: opt %s -dse | llvm-dis | not grep DEAD
0 ; RUN: opt %s -dse -S | not grep DEAD
11
22 define void @test(i32* %Q) {
33 %P = alloca i32 ; [#uses=1]
None ; RUN: opt %s -dse | llvm-dis | not grep store
0 ; RUN: opt %s -dse -S | not grep store
11
22 %struct.x = type { i32, i32, i32, i32 }
33
None ; RUN: opt %s -dse | llvm-dis | not grep DEAD
0 ; RUN: opt %s -dse -S | not grep DEAD
11
22 declare void @ext()
33
None ; RUN: opt %s -dse | llvm-dis | not grep DEAD
0 ; RUN: opt %s -dse -S | not grep DEAD
11
22 define void @test(i32* %Q, i32* %P) {
33 %DEAD = load i32* %Q ; [#uses=1]
None ; RUN: opt %s -dse | llvm-dis | not grep alloca
0 ; RUN: opt %s -dse -S | not grep alloca
11 ; ModuleID = 'placeholder.adb'
22 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-f80:32:32"
33 target triple = "i686-pc-linux-gnu"
None ; RUN: opt %s -dse | llvm-dis | not grep DEAD
0 ; RUN: opt %s -dse -S | not grep DEAD
11
22 define void @test(i32* %Q, i32* %P) {
33 %DEAD = load i32* %Q ; [#uses=1]
None ; RUN: opt %s -dse | llvm-dis | grep {volatile load}
0 ; RUN: opt %s -dse -S | grep {volatile load}
11
22 @g_1 = global i32 0
33
None ; RUN: opt %s -functionattrs | llvm-dis | grep readnone
0 ; RUN: opt %s -functionattrs -S | grep readnone
11
22 define i32 @a() {
33 %tmp = call i32 @b( ) ; [#uses=1]
None ; RUN: opt %s -functionattrs | llvm-dis | grep readnone | count 4
0 ; RUN: opt %s -functionattrs -S | grep readnone | count 4
11 @x = global i32 0
22
33 declare i32 @e() readnone
None ; RUN: opt %s -functionattrs | llvm-dis | grep readonly | count 2
0 ; RUN: opt %s -functionattrs -S | grep readonly | count 2
11
22 define i32 @f() {
33 entry:
None ; RUN: opt %s -functionattrs | llvm-dis | not grep read
0 ; RUN: opt %s -functionattrs -S | not grep read
11 ; PR2792
22
33 @g = global i32 0 ; [#uses=1]
None ; RUN: opt %s -functionattrs | llvm-dis | grep readnone | count 2
0 ; RUN: opt %s -functionattrs -S | grep readnone | count 2
11
22 declare i32 @g(i32*) readnone
33
None ; RUN: opt %s -functionattrs | llvm-dis | grep readnone
0 ; RUN: opt %s -functionattrs -S | grep readnone
11
22 @s = external constant i8 ; [#uses=1]
33
None ; RUN: opt %s -functionattrs | llvm-dis | not grep {nocapture *%%q}
1 ; RUN: opt %s -functionattrs | llvm-dis | grep {nocapture *%%p} | count 6
0 ; RUN: opt %s -functionattrs -S | not grep {nocapture *%%q}
1 ; RUN: opt %s -functionattrs -S | grep {nocapture *%%p} | count 6
22 @g = global i32* null ; [#uses=1]
33
44 define i32* @c1(i32* %q) {
None ; RUN: opt %s -functionattrs | llvm-dis | not grep {nocapture *%%q}
1 ; RUN: opt %s -functionattrs | llvm-dis | grep {nocapture *%%p}
0 ; RUN: opt %s -functionattrs -S | not grep {nocapture *%%q}
1 ; RUN: opt %s -functionattrs -S | grep {nocapture *%%p}
22
33 define i32* @a(i32** %p) {
44 %tmp = load i32** %p
None ; RUN: opt %s -functionattrs | llvm-dis | not grep read
0 ; RUN: opt %s -functionattrs -S | not grep read
11 ; PR3754
22
33 define i8* @m(i32 %size) {
None ; RUN: opt %s -gvn | llvm-dis | not grep {tmp10 =}
0 ; RUN: opt %s -gvn -S | not grep {tmp10 =}
11
22 %struct.INT2 = type { i32, i32 }
33 @blkshifts = external global %struct.INT2* ; <%struct.INT2**> [#uses=2]
None ; RUN: opt %s -gvn | llvm-dis | grep {tmp17625.* = phi i32. }
1 ; RUN: opt %s -gvn | llvm-dis | grep {tmp17631.* = phi i32. }
0 ; RUN: opt %s -gvn -S | grep {tmp17625.* = phi i32. }
1 ; RUN: opt %s -gvn -S | grep {tmp17631.* = phi i32. }
22
33 @last = external global [65 x i32*] ; <[65 x i32*]*> [#uses=1]
44
None ; RUN: opt %s -gvn | llvm-dis | grep {tmp298316 = phi i32 }
0 ; RUN: opt %s -gvn -S | grep {tmp298316 = phi i32 }
11
22 %struct..0anon = type { i32 }
33 %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
None ; RUN: opt %s -gvn | llvm-dis | grep {tmp47 = phi i32 }
0 ; RUN: opt %s -gvn -S | grep {tmp47 = phi i32 }
11
22 %struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* }
33 @debug = external constant i32 ; [#uses=0]
None ; RUN: opt %s -gvn | llvm-dis | not grep {tmp701 =}
0 ; RUN: opt %s -gvn -S | not grep {tmp701 =}
11
22 @img_width = external global i16 ; [#uses=2]
33
None ; RUN: opt %s -gvn | llvm-dis | not grep load
0 ; RUN: opt %s -gvn -S | not grep load
11 ; PR1996
22
33 %struct.anon = type { i32, i8, i8, i8, i8 }
None ; RUN: opt %s -gvn -dse | llvm-dis | grep {call.*memcpy} | count 1
0 ; RUN: opt %s -gvn -dse -S | grep {call.*memcpy} | count 1
11
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"
33 target triple = "x86_64-apple-darwin8"
None ; RUN: opt %s -gvn -dse | llvm-dis | grep {call.*memcpy.*cell} | count 2
0 ; RUN: opt %s -gvn -dse -S | grep {call.*memcpy.*cell} | count 2
11 ; PR2099
22
33 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-f80:128:128"
None ; RUN: opt %s -gvn | llvm-dis | grep {ret i8 \[%\]tmp3}
0 ; RUN: opt %s -gvn -S | grep {ret i8 \[%\]tmp3}
11 ; PR2503
22
33 @g_3 = external global i8 ; [#uses=2]
None ; RUN: opt %s -gvn | llvm-dis | grep getelementptr | count 1
0 ; RUN: opt %s -gvn -S | grep getelementptr | count 1
11
22 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-f80:128:128"
33 target triple = "i386-apple-darwin9.5"
None ; RUN: opt %s -gvn -enable-load-pre | llvm-dis | not grep pre1
0 ; RUN: opt %s -gvn -enable-load-pre -S | not grep pre1
11 ; GVN load pre was hoisting the loads at %13 and %16 up to bb4.outer.
22 ; This is invalid as it bypasses the check for %m.0.ph==null in bb4.
33 ; ModuleID = 'mbuf.c'
None ; RUN: opt %s -gvn | llvm-dis | not grep {%z2 =}
0 ; RUN: opt %s -gvn -S | not grep {%z2 =}
11
22 define i32 @main() {
33 block1:
None ; RUN: opt %s -gvn | llvm-dis | not grep tmp2
0 ; RUN: opt %s -gvn -S | not grep tmp2
11 ; PR2213
22
33 define i32* @f(i8* %x) {
None ; RUN: opt %s -gvn | llvm-dis | grep strlen | count 2
0 ; RUN: opt %s -gvn -S | grep strlen | count 2
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-f80:128:128"
22 target triple = "i386-apple-darwin9"
33
None ; RUN: opt %s -basicaa -gvn | llvm-dis | grep {call.*strlen} | count 1
0 ; RUN: opt %s -basicaa -gvn -S | grep {call.*strlen} | count 1
11 ; Should delete the second call to strlen even though the intervening strchr call exists.
22
33 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-f80:128:128"
None ; RUN: opt %s -gvn | llvm-dis | grep {br i1 false}
0 ; RUN: opt %s -gvn -S | grep {br i1 false}
11
22 @a = external global i32 ; [#uses=7]
33
None ; RUN: opt %s -gvn -instcombine | llvm-dis | grep {ret i32 0}
0 ; RUN: opt %s -gvn -instcombine -S | grep {ret i32 0}
11 ; PR4189
22 @G = external constant [4 x i32]
33
None ; RUN: opt %s -gvn -enable-pre | llvm-dis | grep {b.pre}
0 ; RUN: opt %s -gvn -enable-pre -S | grep {b.pre}
11
22 define i32 @main(i32 %p) {
33 block1:
None ; RUN: opt %s -gvn -enable-load-pre | llvm-dis | grep {%PRE = phi}
0 ; RUN: opt %s -gvn -enable-load-pre -S | grep {%PRE = phi}
11
22 define i32 @test(i32* %p, i1 %C) {
33 block1:
None ; RUN: opt %s -gvn | llvm-dis | not grep DEADLOAD
1 ; RUN: opt %s -gvn | llvm-dis | not grep DEADGEP
0 ; RUN: opt %s -gvn -S | not grep DEADLOAD
1 ; RUN: opt %s -gvn -S | not grep DEADGEP
22
33 define i32 @main(i32** %p) {
44 block1:
None ; RUN: opt %s -gvn -enable-pre | llvm-dis | grep {.pre}
0 ; RUN: opt %s -gvn -enable-pre -S | grep {.pre}
11
22 @H = common global i32 0 ; [#uses=2]
33 @G = common global i32 0 ; [#uses=1]
None ; RUN: opt %s -gvn -enable-load-pre | llvm-dis | not grep {tmp3 = load}
0 ; RUN: opt %s -gvn -enable-load-pre -S | not grep {tmp3 = load}
11
22 @p = external global i32
33 define i32 @f(i32 %n) nounwind {
None ; RUN: opt %s -gvn | llvm-dis | grep load | count 2
0 ; RUN: opt %s -gvn -S | grep load | count 2
11
22 define i32 @main(i32** %p) {
33 block1:
None ; RUN: opt %s -gvn | llvm-dis | grep {DEAD = phi i32 }
0 ; RUN: opt %s -gvn -S | grep {DEAD = phi i32 }
11 ; XFAIL: *
22
33 ; FIXME: GVN should eliminate the fully redundant %9 GEP which
None ; RUN: opt %s -gvn | llvm-dis | grep load
0 ; RUN: opt %s -gvn -S | grep load
11 ; FIXME: This should be promotable, but memdep/gvn don't track values
22 ; path/edge sensitively enough.
33
None ; RUN: opt %s -gvn | llvm-dis | grep {%DEAD = phi i32. }
0 ; RUN: opt %s -gvn -S | grep {%DEAD = phi i32. }
11
22 define i32 @main(i32** %p) {
33 block1:
None ; RUN: opt %s -gvn | llvm-dis | grep {%cv = phi i32}
1 ; RUN: opt %s -gvn | llvm-dis | grep {%bv = phi i32}
0 ; RUN: opt %s -gvn -S | grep {%cv = phi i32}
1 ; RUN: opt %s -gvn -S | grep {%bv = phi i32}
22 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-f80:128:128"
33 target triple = "i386-apple-darwin7"
44
None ; RUN: opt %s -gvn | llvm-dis | grep {DEAD = phi i32 }
0 ; RUN: opt %s -gvn -S | grep {DEAD = phi i32 }
11
22 define i32 @main(i32* %p) {
33 block1:
None ; RUN: opt %s -gvnpre | llvm-dis | grep tmp114115.gvnpre
0 ; RUN: opt %s -gvnpre -S | grep tmp114115.gvnpre
11
22 %struct.AV = type { %struct.XPVAV*, i32, i32 }
33 %struct.CLONE_PARAMS = type { %struct.AV*, i32, %struct.PerlInterpreter* }
None ; RUN: opt %s -gvnpre | llvm-dis | not grep {%z3 =}
1 ; RUN: opt %s -gvnpre | llvm-dis | not grep {%z9 =}
0 ; RUN: opt %s -gvnpre -S | not grep {%z3 =}
1 ; RUN: opt %s -gvnpre -S | not grep {%z9 =}
22
33 define i32 @main() {
44 block1:
None ; RUN: opt %s -gvnpre | llvm-dis | grep b.gvnpre
0 ; RUN: opt %s -gvnpre -S | grep b.gvnpre
11
22 define i32 @extract() {
33 entry: ; preds = %cond_false, %entry
None ; RUN: opt %s -gvnpre | llvm-dis | grep b.gvnpre
0 ; RUN: opt %s -gvnpre -S | grep b.gvnpre
11
22 define i32 @extract() {
33 entry: ; preds = %cond_false, %entry
None ; RUN: opt %s -gvnpre | llvm-dis | grep b.gvnpre
0 ; RUN: opt %s -gvnpre -S | grep b.gvnpre
11
22 define i32 @extract({ i32 }* %P) {
33 entry: ; preds = %cond_false, %entry
None ; RUN: opt %s -gvnpre | llvm-dis | grep b.gvnpre
0 ; RUN: opt %s -gvnpre -S | grep b.gvnpre
11
22 define i32 @extract() {
33 entry: ; preds = %cond_false, %entry
None ; RUN: opt %s -gvnpre | llvm-dis | grep b.gvnpre
0 ; RUN: opt %s -gvnpre -S | grep b.gvnpre
11
22 define i32 @extract() {
33 entry: ; preds = %cond_false, %entry
None ; RUN: opt %s -gvnpre | llvm-dis | grep b.gvnpre
0 ; RUN: opt %s -gvnpre -S | grep b.gvnpre
11
22 define i32 @extract() {
33 entry: ; preds = %cond_false, %entry
0 ; Make sure that functions are removed successfully if they are referred to by
11 ; a global that is dead. Make sure any globals they refer to die as well.
22
3 ; RUN: opt %s -globaldce | llvm-dis | not grep foo
3 ; RUN: opt %s -globaldce -S | not grep foo
44
55 ;; Unused, kills %foo
66 @b = internal global i32 ()* @foo ; [#uses=0]
0 ; This testcase tests that a worklist is being used, and that globals can be
11 ; removed if they are the subject of a constexpr and ConstantPointerRef
22
3 ; RUN: opt %s -globaldce | llvm-dis | not grep global
3 ; RUN: opt %s -globaldce -S | not grep global
44
55 @t0 = internal global [4 x i8] c"foo\00" ; <[4 x i8]*> [#uses=1]
66 @t1 = internal global [4 x i8] c"bar\00" ; <[4 x i8]*> [#uses=1]
0 ; distilled from 255.vortex
1 ; RUN: opt %s -globaldce | llvm-dis | not grep testfunc
1 ; RUN: opt %s -globaldce -S | not grep testfunc
22
33 declare i1 ()* @getfunc()
44
0 ; Weak variables should be preserved by global DCE!
11
2 ; RUN: opt %s -globaldce | llvm-dis | grep @A
2 ; RUN: opt %s -globaldce -S | grep @A
33
44
55 @A = weak global i32 54
None ; RUN: opt %s -globaldce | llvm-dis | not grep @D
1 ; RUN: opt %s -globaldce | llvm-dis | grep @L | count 3
0 ; RUN: opt %s -globaldce -S | not grep @D
1 ; RUN: opt %s -globaldce -S | grep @L | count 3
22
33 @A = global i32 0
44 @D = alias internal i32* @A
None ; RUN: opt %s -globaldce | llvm-dis | not grep global
0 ; RUN: opt %s -globaldce -S | not grep global
11
22 @X = external global i32
33 @Y = internal global i32 7
None ; RUN: opt %s -globaldce | llvm-dis | not grep test_
0 ; RUN: opt %s -globaldce -S | not grep test_
11
22 ; test_function should not be emitted to the .s file.
33 define available_externally i32 @test_function() {
None ; RUN: opt %s -globalopt | llvm-dis | grep {16 x .31 x double.. zeroinitializer}
0 ; RUN: opt %s -globalopt -S | grep {16 x .31 x double.. zeroinitializer}
11
22 ; The 'X' indices could be larger than 31. Do not SROA the outer indices of this array.
33 @mm = internal global [16 x [31 x double]] zeroinitializer, align 32
None ; RUN: opt %s -globalopt | llvm-dis | grep {volatile load}
0 ; RUN: opt %s -globalopt -S | grep {volatile load}
11 @t0.1441 = internal global double 0x3FD5555555555555, align 8 ; [#uses=1]
22
33 define double @foo() nounwind {
None ; RUN: opt %s -globalopt | llvm-dis | grep { nest } | count 1
0 ; RUN: opt %s -globalopt -S | grep { nest } | count 1
11 %struct.FRAME.nest = type { i32, i32 (i32)* }
22 %struct.__builtin_trampoline = type { [10 x i8] }
33 @.str = internal constant [7 x i8] c"%d %d\0A\00" ; <[7 x i8]*> [#uses=1]
11 ; alignments. Elements 0 and 2 must be 16-byte aligned, and element
22 ; 1 must be at least 8 byte aligned (but could be more).
33
4 ; RUN: opt %s -globalopt | llvm-dis | grep {@G.0 = internal global .*align 16}
5 ; RUN: opt %s -globalopt | llvm-dis | grep {@G.1 = internal global .*align 8}
6 ; RUN: opt %s -globalopt | llvm-dis | grep {@G.2 = internal global .*align 16}
4 ; RUN: opt %s -globalopt -S | grep {@G.0 = internal global .*align 16}
5 ; RUN: opt %s -globalopt -S | grep {@G.1 = internal global .*align 8}
6 ; RUN: opt %s -globalopt -S | grep {@G.2 = internal global .*align 16}
77 ; rdar://5891920
88
99 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:32:32-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
11 ; values. This used to crash, because globalopt forgot to put the new var in the
22 ; same address space as the old one.
33
4 ; RUN: opt %s -globalopt | llvm-dis > %t
4 ; RUN: opt %s -globalopt -S > %t
55 ; Check that the new global values still have their address space
66 ; RUN: cat %t | grep global.*addrspace
77
None ; RUN: opt %s -globalopt | llvm-dis | grep {phi.*@head}
0 ; RUN: opt %s -globalopt -S | grep {phi.*@head}
11 ; PR3321
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"
33 target triple = "x86_64-unknown-linux-gnu"
None ; RUN: opt %s -globalopt | llvm-dis | grep {define void @a}
0 ; RUN: opt %s -globalopt -S | grep {define void @a}
11
22 define internal void @f() {
33 ret void
None ; RUN: opt %s -globalopt | llvm-dis | not grep global_variable42
0 ; RUN: opt %s -globalopt -S | not grep global_variable42
11 ; XFAIL: *
22
33 %llvm.dbg.anchor.type = type { i32, i32 }
None ; RUN: opt %s -globalopt | llvm-dis | grep internal | count 2
0 ; RUN: opt %s -globalopt -S | grep internal | count 2
11
22 global i32 0
33 define i32* @1() {
None ; RUN: opt %s -globalopt | llvm-dis | grep {@X = internal global i32}
0 ; RUN: opt %s -globalopt -S | grep {@X = internal global i32}
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-f80:128:128"
22 target triple = "i386-apple-darwin7"
33 @X = internal global i32* null ; [#uses=2]
None ; RUN: opt %s -globalopt | llvm-dis > %t
0 ; RUN: opt %s -globalopt -S > %t
11 ; RUN: cat %t | grep foo1 | count 1
22 ; RUN: cat %t | grep foo2 | count 4
33 ; RUN: cat %t | grep bar1 | count 1
None ; RUN: opt %s -globalopt | llvm-dis | not grep global
0 ; RUN: opt %s -globalopt -S | not grep global
11
22 @X = internal global i32 4 ; [#uses=1]
33
None ; RUN: opt %s -instcombine -globalopt | llvm-dis | \
0 ; RUN: opt %s -instcombine -globalopt -S | \
11 ; RUN: grep {internal fastcc float @foo}
22
33 define internal float @foo() {
None ; RUN: opt %s -globalopt | llvm-dis | not grep CTOR
0 ; RUN: opt %s -globalopt -S | not grep CTOR
11 @llvm.global_ctors = appending global [10 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR2 }, { i32, void ()* } { i32 65535, void ()* @CTOR3 }, { i32, void ()* } { i32 65535, void ()* @CTOR4 }, { i32, void ()* } { i32 65535, void ()* @CTOR5 }, { i32, void ()* } { i32 65535, void ()* @CTOR6 }, { i32, void ()* } { i32 65535, void ()* @CTOR7 }, { i32, void ()* } { i32 65535, void ()* @CTOR8 }, { i32, void ()* } { i32 2147483647, void ()* null } ] ; <[10 x { i32, void ()* }]*> [#uses=0]
22 @G = global i32 0 ; [#uses=1]
33 @G2 = global i32 0 ; [#uses=1]
None ; RUN: opt %s -globalopt | llvm-dis | FileCheck %s
0 ; RUN: opt %s -globalopt -S | FileCheck %s
11
22 ; Don't get fooled by the inbounds keyword; it doesn't change
33 ; the computed address.
None ; RUN: opt %s -globalopt | llvm-dis | not grep CTOR
0 ; RUN: opt %s -globalopt -S | not grep CTOR
11 @llvm.global_ctors = appending global [10 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR2 }, { i32, void ()* } { i32 65535, void ()* @CTOR3 }, { i32, void ()* } { i32 65535, void ()* @CTOR4 }, { i32, void ()* } { i32 65535, void ()* @CTOR5 }, { i32, void ()* } { i32 65535, void ()* @CTOR6 }, { i32, void ()* } { i32 65535, void ()* @CTOR7 }, { i32, void ()* } { i32 65535, void ()* @CTOR8 }, { i32, void ()* } { i32 2147483647, void ()* null } ] ; <[10 x { i32, void ()* }]*> [#uses=0]
22 @G = global i32 0 ; [#uses=1]
33 @G2 = global i32 0 ; [#uses=1]
None ; RUN: opt %s -globalopt | llvm-dis | not grep internal
0 ; RUN: opt %s -globalopt -S | not grep internal
11
22 ; This is a harder case to delete as the GEP has a variable index.
33
None ; RUN: opt %s -globalopt | llvm-dis | not grep internal
0 ; RUN: opt %s -globalopt -S | not grep internal
11
22 @G = internal global i32 123 ; [#uses=1]
33
0 ; In this case, the global can only be broken up by one level.
11
2 ; RUN: opt %s -globalopt | llvm-dis | not grep 12345
2 ; RUN: opt %s -globalopt -S | not grep 12345
33
44 @G = internal global { i32, [4 x float] } zeroinitializer ; <{ i32, [4 x float] }*> [#uses=3]
55
None ; RUN: opt %s -globalopt | llvm-dis > %t
0 ; RUN: opt %s -globalopt -S > %t
11 ; RUN: grep {@Y = internal global \\\[3 x \[%\]struct.X\\\] zeroinitializer} %t
22 ; RUN: grep load %t | count 6
33 ; RUN: grep {add i32 \[%\]a, \[%\]b} %t | count 3
None ; RUN: opt %s -globalopt | llvm-dis | not grep global
0 ; RUN: opt < %s -globalopt -S | not grep global
11
22 @G = internal global { i32, float, { double } } {
33 i32 1,
None ; RUN: opt %s -globalopt | llvm-dis | grep {@X.f0}
1 ; RUN: opt %s -globalopt | llvm-dis | grep {@X.f1}
0 ; RUN: opt %s -globalopt -S | grep {@X.f0}
1 ; RUN: opt %s -globalopt -S | grep {@X.f1}
22 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-f80:128:128"
33 target triple = "i386-apple-darwin7"
44
None ; RUN: opt %s -globalopt | llvm-dis | grep {@X.f0}
1 ; RUN: opt %s -globalopt | llvm-dis | grep {@X.f1}
0 ; RUN: opt %s -globalopt -S | grep {@X.f0}
1 ; RUN: opt %s -globalopt -S | grep {@X.f1}
22
33 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-f80:128:128"
44 target triple = "i386-apple-darwin7"
None ; RUN: opt %s -globalopt | llvm-dis | grep {tmp.f1 = phi i32. }
1 ; RUN: opt %s -globalopt | llvm-dis | grep {tmp.f0 = phi i32. }
0 ; RUN: opt %s -globalopt -S | grep {tmp.f1 = phi i32. }
1 ; RUN: opt %s -globalopt -S | grep {tmp.f0 = phi i32. }
22
33 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-f80:128:128"
44 target triple = "i386-apple-darwin7"
None ; RUN: opt %s -globalopt | llvm-dis | not grep %G
0 ; RUN: opt %s -globalopt -S | not grep %G
11
22 @G = internal global i32 0 ; [#uses=1]
33 @H = internal global { i32* } { i32* @G } ; <{ i32* }*> [#uses=1]
None ; RUN: opt %s -globalopt | llvm-dis | not grep G
0 ; RUN: opt < %s -globalopt -S | not grep G
11
22 @G = internal global i32 17 ; [#uses=3]
33
None ; RUN: opt %s -globalopt | llvm-dis | not grep global
0 ; RUN: opt %s -globalopt -S | not grep global
11
22 @G = internal global i32* null ; [#uses=3]
33
None ; RUN: opt %s -globalopt | llvm-dis | not grep malloc
0 ; RUN: opt < %s -globalopt -S | not grep malloc
11
22 @G = internal global i32* null ; [#uses=3]
33
None ; RUN: opt %s -globalopt | llvm-dis | not grep malloc
0 ; RUN: opt < %s -globalopt -S | not grep malloc
11
22 @G = internal global i32* null ; [#uses=4]
33
None ; RUN: opt %s -globalopt | llvm-dis | \
0 ; RUN: opt %s -globalopt -S | \
11 ; RUN: grep {G1 = internal constant}
22
33 @G1 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1]
0 ; both globals are write only, delete them.
11
2 ; RUN: opt %s -globalopt | llvm-dis | \
2 ; RUN: opt %s -globalopt -S | \
33 ; RUN: not grep internal
44
55 @G0 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1]
0 ; Test that PHI nodes and select instructions do not necessarily make stuff
11 ; non-constant.
22
3 ; RUN: opt %s -globalopt | llvm-dis | not grep global
3 ; RUN: opt %s -globalopt -S | not grep global
44
55 @X = internal global i32 4 ; [#uses=2]
66 @Y = internal global i32 5 ; [#uses=2]
None ; RUN: opt %s -globalopt | llvm-dis | \
0 ; RUN: opt %s -globalopt -S | \
11 ; RUN: grep {call void @Actual}
22
33 ; Check that a comparison does not prevent an indirect call from being made
None ; RUN: opt %s -globalopt | llvm-dis | not grep global
0 ; RUN: opt %s -globalopt -S | not grep global
11
22 @G = internal global void ()* null ; [#uses=2]
33
None ; RUN: opt %s -globalopt | llvm-dis | not grep G
0 ; RUN: opt < %s -globalopt -S | not grep G
11
22 @G = internal global i32 17 ; [#uses=3]
33
None ; RUN: opt %s -globalopt | llvm-dis | not grep store
0 ; RUN: opt %s -globalopt -S | not grep store
11
22 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z3foov } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
33 @X.0 = internal global i32 undef ; [#uses=2]
None ; RUN: opt %s -ipconstprop | llvm-dis | grep {ret i32 %r}
0 ; RUN: opt %s -ipconstprop -S | grep {ret i32 %r}
11 ; Should not propagate the result of a weak function.
22 ; PR2411
33
None ; RUN: opt %s -ipconstprop -deadargelim | llvm-dis | not grep %X
0 ; RUN: opt %s -ipconstprop -deadargelim -S | not grep %X
11 define internal i32 @foo(i32 %X) {
22 %Y = call i32 @foo( i32 %X ) ; [#uses=1]
33 %Z = add i32 %Y, 1 ; [#uses=1]
None ; RUN: opt %s -ipconstprop | llvm-dis > %t
0 ; RUN: opt %s -ipconstprop -S > %t
11 ; RUN: cat %t | grep {store i32 %Z, i32\\* %Q}
22 ; RUN: cat %t | grep {add i32 1, 3}
33
None ; RUN: opt %s -ipconstprop | llvm-dis > %t
0 ; RUN: opt %s -ipconstprop -S > %t
11 ;; Check that the 21 constants got propagated properly
22 ; RUN: cat %t | grep {%M = add i32 21, 21}
33 ;; Check that the second return values didn't get propagated
None ; RUN: opt %s -indmemrem | llvm-dis | grep bounce | grep noalias
0 ; RUN: opt %s -indmemrem -S | grep bounce | grep noalias
11
22 declare i8* @malloc(i32)
33
None ; RUN: opt %s -indvars | llvm-dis | grep indvar
0 ; RUN: opt %s -indvars -S | grep indvar
11
22 define i32 @test() {
33 ;
0 ; The induction variable canonicalization pass shouldn't leave dead
11 ; instructions laying around!
22 ;
3 ; RUN: opt %s -indvars | llvm-dis | \
3 ; RUN: opt %s -indvars -S | \
44 ; RUN: not grep {#uses=0}
55
66 define i32 @mul(i32 %x, i32 %y) {
None ; RUN: opt %s -indvars | llvm-dis | grep indvar | not grep i32
0 ; RUN: opt %s -indvars -S | grep indvar | not grep i32
11
22 @G = global i64 0 ; [#uses=1]
33
None ; RUN: opt %s -indvars | llvm-dis | \
0 ; RUN: opt %s -indvars -S | \
11 ; RUN: grep {ret i32 152}
22
33 define i32 @main() {
0 ; PR726
1 ; RUN: opt %s -indvars | llvm-dis | \
1 ; RUN: opt %s -indvars -S | \
22 ; RUN: grep {ret i32 27}
33
44 ; Make sure to compute the right exit value based on negative strides.
0 ; PR1015
1 ; RUN: opt %s -indvars | llvm-dis | not grep {ret i32 0}
1 ; RUN: opt %s -indvars -S | not grep {ret i32 0}
22
33 target datalayout = "e-p:32:32"
44 target triple = "i686-apple-darwin8"
None ; RUN: opt %s -indvars | llvm-dis | grep sext | count 1
0 ; RUN: opt %s -indvars -S | grep sext | count 1
11 ; ModuleID = ''
22
33 %struct.App1Marker = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }>
None ; RUN: opt %s -indvars | llvm-dis | grep icmp | count 4
0 ; RUN: opt %s -indvars -S | grep icmp | count 4
11 define void @bar() nounwind {
22 entry:
33 br label %bb
None ; RUN: opt %s -indvars | llvm-dis | grep icmp | count 2
1 ; RUN: opt %s -indvars | llvm-dis | grep sitofp | count 1
2 ; RUN: opt %s -indvars | llvm-dis | grep uitofp | count 1
0 ; RUN: opt %s -indvars -S | grep icmp | count 2
1 ; RUN: opt %s -indvars -S | grep sitofp | count 1
2 ; RUN: opt %s -indvars -S | grep uitofp | count 1
33
44 define void @bar() nounwind {
55 entry:
None ; RUN: opt %s -indvars | llvm-dis | not grep {sext}
0 ; RUN: opt %s -indvars -S | not grep {sext}
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"
33 target triple = "x86_64-apple-darwin9.6"
None ; RUN: opt %s -indvars -instcombine | llvm-dis | not grep {\[sz\]ext}
0 ; RUN: opt %s -indvars -instcombine -S | not grep {\[sz\]ext}
11 ; ModuleID = ''
22 ;extern int *a, *b, *c, *d, *e, *f; /* 64 bit */
33 ;extern int K[256];
None ; RUN: opt %s -indvars | llvm-dis | grep icmp | grep next
0 ; RUN: opt %s -indvars -S | grep icmp | grep next
11 ; PR4086
22 declare void @foo()
33
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep phi %t | count 4
22 ; RUN: grep {= phi i32} %t | count 4
33 ; RUN: not grep {sext i} %t
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep getelementptr %t | count 1
22 ; RUN: grep {mul .*, 37} %t | count 1
33 ; RUN: grep {add .*, 5203} %t | count 1
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep sext %t | count 1
22
33 ; Indvars should be able to eliminate all of the sign extensions
0 ; The i induction variable looks like a wrap-around, but it really is just
11 ; a simple affine IV. Make sure that indvars eliminates it.
22
3 ; RUN: opt %s -indvars | llvm-dis | grep phi | count 1
3 ; RUN: opt %s -indvars -S | grep phi | count 1
44
55 define void @foo() {
66 entry:
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt < %s -indvars -S > %t
11 ; RUN: grep add %t | count 8
22 ; RUN: grep mul %t | count 7
33
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep {= sext} %t | count 4
22 ; RUN: grep {phi i64} %t | count 2
33
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt < %s -indvars -S > %t
11 ; RUN: not grep and %t
22 ; RUN: not grep zext %t
33
None ; RUN: opt %s -indvars | llvm-dis | grep add | count 1
0 ; RUN: opt %s -indvars -S | grep add | count 1
11
22 ; Indvars should be able to compute the exit value of this loop
33 ; without any additional arithmetic. The only add needed should
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 | llvm-dis | not grep mul
2 ; RUN: opt %s -indvars -dce -S | not grep mul
33
44 @A = external global i32 ; [#uses=1]
55
None ; RUN: opt %s -indvars | llvm-dis | not grep select
0 ; RUN: opt %s -indvars -S | not grep select
11
22 ; This loop has backedge-taken-count zero. Indvars shouldn't expand any
33 ; instructions to compute a trip count.
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep {\[%\]tmp7 = icmp eq i8 -28, -28} %t
22 ; RUN: grep {\[%\]tmp8 = icmp eq i8 63, 63} %t
33 ; PR4477
None ; RUN: opt %s -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
0 ; RUN: opt %s -indvars -loop-deletion -simplifycfg -S | not grep br
11 ;
22 ; Testcase distilled from 256.bzip2
33
None ; RUN: opt %s -indvars | llvm-dis | grep {ret i32 600000}
0 ; RUN: opt %s -indvars -S | grep {ret i32 600000}
11 ; PR1179
22
33 define i32 @foo() {
None ; RUN: opt %s -indvars | llvm-dis | grep {ret i32 9900}
0 ; RUN: opt %s -indvars -S | grep {ret i32 9900}
11 ; PR1179
22
33 define i32 @test4() {
None ; RUN: opt %s -indvars | llvm-dis | grep {120, %bb2.bb3_crit_edge}
0 ; RUN: opt %s -indvars -S | grep {120, %bb2.bb3_crit_edge}
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
None ; RUN: opt %s -indvars -loop-deletion | llvm-dis | grep phi | count 1
0 ; RUN: opt %s -indvars -loop-deletion -S | grep phi | count 1
11 ; XFAIL: *
22
33 ; Indvars can't evaluate this loop, because ScalarEvolution can't compute
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: not grep trunc %t
22 ; RUN: grep and %t | count 1
33
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep {icmp ugt i8\\\*} %t | count 1
22 ; RUN: grep {icmp sgt i8\\\*} %t | count 1
33
None ; RUN: opt %s -indvars | llvm-dis | grep indvar
0 ; RUN: opt %s -indvars -S | grep indvar
11 @G = global i32* null ; [#uses=1]
22 @Array = external global [40 x i32] ; <[40 x i32]*> [#uses=1]
33
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep {%exitcond = icmp eq i64 %indvar.next, %n} %t
22 ; RUN: grep {getelementptr i8\\* %A, i64 %indvar} %t
33 ; RUN: grep getelementptr %t | count 1
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; Exactly one getelementptr for each load+store.
22 ; RUN: grep getelementptr %t | count 6
33 ; Each getelementptr using %struct.Q* %s as a base and not i8*.
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: not grep ptrtoint %t
22 ; RUN: not grep inttoptr %t
33 ; RUN: grep getelementptr %t | count 1
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: grep sext %t | count 1
22 ; RUN: grep phi %t | count 1
33 ; RUN: grep {phi i64} %t
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: not grep sext %t
22
33 define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly {
None ; RUN: opt %s -indvars | llvm-dis > %t
0 ; RUN: opt %s -indvars -S > %t
11 ; RUN: not grep sext %t
22 ; RUN: grep phi %t | count 1
33
None ; RUN: opt %s -indvars | llvm-dis | FileCheck %s
0 ; RUN: opt %s -indvars -S | FileCheck %s
11 ; PR4775
22
33 ; Indvars shouldn't sink the alloca out of the entry block, even though
None ; RUN: opt %s -indvars | llvm-dis | FileCheck %s --check-prefix=CHECK
0 ; RUN: opt %s -indvars -S | FileCheck %s --check-prefix=CHECK
11
22 declare i1 @b()
33
None ; RUN: opt %s -indvars | llvm-dis | grep indvar
0 ; RUN: opt %s -indvars -S | grep indvar
11
22 @G = global i64 0 ; [#uses=1]
33
22 ; the exit value of the loop will be for some value, allowing us to substitute
33 ; it directly into users outside of the loop, making the loop dead.
44 ;
5 ; RUN: opt %s -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
5 ; RUN: opt %s -indvars -loop-deletion -simplifycfg -S | not grep br
66
77 define i32 @linear_setne() {
88 entry:
0 ; These tests have an infinite trip count. We obviously shouldn't remove the
11 ; loops! :)
22 ;
3 ; RUN: opt %s -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2
3 ; RUN: opt %s -indvars -adce -simplifycfg -S | grep icmp | wc -l > %t2
44 ; RUN: llvm-as < %s | llvm-dis | grep icmp | wc -l > %t1
55 ; RUN: diff %t1 %t2
66
None ; RUN: opt %s -indvars -instcombine | llvm-dis | \
0 ; RUN: opt %s -indvars -instcombine -S | \
11 ; RUN: grep {store i32 0}
22 ; Test that -indvars can reduce variable stride IVs. If it can reduce variable
33 ; stride iv's, it will make %iv. and %m.0.0 isomorphic to each other without
None ; RUN: opt %s -inline | llvm-dis | not grep {invoke void asm}
0 ; RUN: opt %s -inline -S | not grep {invoke void asm}
11 ; PR1335
22
33 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"
None ; RUN: opt %s -inline | llvm-dis | grep "define internal i32 @bar"
0 ; RUN: opt %s -inline -S | grep "define internal i32 @bar"
11 @llvm.noinline = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32)* @bar to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
22
33 define internal i32 @bar(i32 %x, i32 %y) {
None ; RUN: opt %s -inline | llvm-dis | grep call
0 ; RUN: opt %s -inline -S | grep call
11
22 ; 'bar' can be overridden at link-time, don't inline it.
33
None ; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep nounwind
1 ; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep unreachable
0 ; RUN: llvm-as %s -o - | opt -inline -S | grep nounwind
1 ; RUN: llvm-as %s -o - | opt -inline -S | grep unreachable
22
33 declare i1 @extern()
44
None ; RUN: opt %s -inline-threshold=0 -inline | llvm-dis | not grep call
0 ; RUN: opt %s -inline-threshold=0 -inline -S | not grep call
11
22 define i32 @fn2() alwaysinline {
33 ret i32 1
None ; RUN: opt %s -inline | llvm-dis | grep call | count 1
0 ; RUN: opt %s -inline -S | grep call | count 1
11
22 define i32 @fn2() noinline {
33 ret i32 1
None ; RUN: opt %s -always-inline | llvm-dis | not grep call
0 ; RUN: opt %s -always-inline -S | not grep call
11
22 ; Ensure that threshold doesn't disrupt always inline.
3 ; RUN: opt %s -inline-threshold=-2000000001 -always-inline | llvm-dis | not grep call
3 ; RUN: opt %s -inline-threshold=-2000000001 -always-inline -S | not grep call
44
55
66 define internal i32 @if0() alwaysinline {
None ; RUN: opt %s -always-inline | llvm-dis | grep {@foo}
0 ; RUN: opt %s -always-inline -S | grep {@foo}
11 ; Ensure that foo is not removed by always inliner
22 ; PR 2945
33
None ; RUN: opt %s -inline | llvm-dis | grep call
0 ; RUN: opt %s -inline -S | grep call
11 ; Do not inline calls to variable-sized alloca.
22
33 @q = common global i8* null ; [#uses=1]
None ; RUN: opt %s -inline | llvm-dis | grep {call.*fib} | count 4
0 ; RUN: opt %s -inline -S | grep {call.*fib} | count 4
11 ; First call to fib from fib is inlined, producing 2 instead of 1, total 3.
22 ; Second call to fib from fib is not inlined because new body of fib exceeds
33 ; inlining limit of 200. Plus call in main = 4 total.
None ; RUN: opt %s -inline | llvm-dis | not grep callee
0 ; RUN: opt %s -inline -S | not grep callee
11 ; rdar://6655932
22
33 ; If callee is marked alwaysinline, inline it! Even if callee has dynamic
None ; RUN: opt %s -inline | llvm-dis | FileCheck %s
0 ; RUN: opt %s -inline -S | FileCheck %s
11 ; rdar://7173846
22 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-f80:128:128"
33 target triple = "i386-apple-darwin10.0"
None ; RUN: opt %s -inline | llvm-dis | grep {llvm.memcpy}
0 ; RUN: opt %s -inline -S | grep {llvm.memcpy}
11
22 ; Inlining a byval struct should cause an explicit copy into an alloca.
33
None ; RUN: opt %s -inline | llvm-dis | not grep {llvm.memcpy}
0 ; RUN: opt %s -inline -S | not grep {llvm.memcpy}
11
22 ; Inlining a byval struct should NOT cause an explicit copy
33 ; into an alloca if the function is readonly
None ; RUN: opt %s -inline | llvm-dis | grep {ret i32 1}
0 ; RUN: opt %s -inline -S | grep {ret i32 1}
11 ; ModuleID = 'short.opt.bc'
22
33 define i32 @testBool(i1 %X) {
0 ; This test ensures that inlining an "empty" function does not destroy the CFG
11 ;
2 ; RUN: opt %s -inline | llvm-dis | not grep br
2 ; RUN: opt %s -inline -S | not grep br
33
44 define i32 @func(i32 %i) {
55 ret i32 %i
22 ; Functions with dynamic allocas can only be inlined into functions that
33 ; already have dynamic allocas.
44
5 ; RUN: opt %s -inline | llvm-dis | \
5 ; RUN: opt %s -inline -S | \
66 ; RUN: grep llvm.stacksave
7 ; RUN: opt %s -inline | llvm-dis | not grep callee
7 ; RUN: opt %s -inline -S | not grep callee
88
99
1010 declare void @ext(i32*)
None ; RUN: opt %s -inline -constprop | llvm-dis > %t
0 ; RUN: opt %s -inline -constprop -S > %t
11 ; RUN: not grep test_function %t
22 ; RUN: grep {ret i32 5} %t
33
None ; RUN: opt %s -inline | llvm-dis | not grep {tail call void @llvm.memcpy.i32}
0 ; RUN: opt %s -inline -S | not grep {tail call void @llvm.memcpy.i32}
11 ; PR3550
22
33 define internal void @foo(i32* %p, i32* %q) {
None ; RUN: opt %s -inline | llvm-dis | not grep tail
0 ; RUN: opt < %s -inline -S | not grep tail
11
22 declare void @bar(i32*)
33
0 ; Test that the inliner doesn't leave around dead allocas, and that it folds
11 ; uncond branches away after it is done specializing.
22
3 ; RUN: opt %s -inline | llvm-dis | \
3 ; RUN: opt %s -inline -S | \
44 ; RUN: not grep {alloca.*uses=0}
5 ; RUN: opt %s -inline | llvm-dis | \
5 ; RUN: opt %s -inline -S | \
66 ; RUN: not grep {br label}
77 @A = weak global i32 0 ; [#uses=1]
88 @B = weak global i32 0 ; [#uses=1]
None ; RUN: opt %s -inline | llvm-dis | not grep callee
1 ; RUN: opt %s -inline | llvm-dis | not grep div
0 ; RUN: opt %s -inline -S | not grep callee
1 ; RUN: opt %s -inline -S | not grep div
22
33
44 define internal i32 @callee(i32 %A, i32 %B) {
0 ; This checks to ensure that the inline pass deletes functions if they get
11 ; inlined into all of their callers.
22
3 ; RUN: opt %s -inline | llvm-dis | \
3 ; RUN: opt %s -inline -S | \
44 ; RUN: not grep @reallysmall
55
66 define internal i32 @reallysmall(i32 %A) {
None ; RUN: opt %s -inline | llvm-dis | \
0 ; RUN: opt %s -inline -S | \
11 ; RUN: not grep {callee\[12\](}
2 ; RUN: opt %s -inline | llvm-dis | not grep mul
2 ; RUN: opt %s -inline -S | not grep mul
33
44 define internal i32 @callee1(i32 %A, i32 %B) {
55 %cond = icmp eq i32 %A, 123 ; [#uses=1]
0 ; Test that we can inline a simple function, turning the calls in it into invoke
11 ; instructions
22
3 ; RUN: opt %s -inline | llvm-dis | \
3 ; RUN: opt %s -inline -S | \
44 ; RUN: not grep {call\[^e\]}
55
66 declare void @might_throw()
0 ; Test that if an invoked function is inlined, and if that function cannot
11 ; throw, that the dead handler is now unreachable.
22
3 ; RUN: opt %s -inline -simplifycfg | llvm-dis | \
3 ; RUN: opt %s -inline -simplifycfg -S | \
44 ; RUN: not grep UnreachableExceptionHandler
55
66 declare void @might_throw()
0 ; Test that any rethrown exceptions in an inlined function are automatically
11 ; turned into branches to the invoke destination.
22
3 ; RUN: opt %s -inline | llvm-dis | not grep unwind$
3 ; RUN: opt %s -inline -S | not grep unwind$
44
55 declare void @might_throw()
66
0 ; Instcombine was missing a test that caused it to make illegal transformations
11 ; sometimes. In this case, it transforms the sub into an add:
2 ; RUN: opt %s -instcombine | llvm-dis | grep sub
2 ; RUN: opt %s -instcombine -S | grep sub
33 ;
44 define i32 @test(i32 %i, i32 %j) {
55 %A = mul i32 %i, %j
0 ; This testcase is incorrectly getting completely eliminated. There should be
11 ; SOME instruction named %c here, even if it's a bitwise and.
22 ;
3 ; RUN: opt %s -instcombine | llvm-dis | grep %c
3 ; RUN: opt %s -instcombine -S | grep %c
44 ;
55 define i64 @test3(i64 %A) {
66 %c1 = trunc i64 %A to i8 ; [#uses=1]
None ; RUN: opt %s -instcombine | llvm-dis | not grep add
0 ; RUN: opt %s -instcombine -S | not grep add
11
22 define i32 @test(i32 %A) {
33 %A.neg = sub i32 0, %A ; [#uses=1]
None ; RUN: opt %s -instcombine | llvm-dis | grep 4294967295
0 ; RUN: opt %s -instcombine -S | grep 4294967295
11
22 define i64 @test(i64 %Val) {
33 %tmp.3 = trunc i64 %Val to i32 ; [#uses=1]
None ; RUN: opt %s -instcombine | llvm-dis | grep load
0 ; RUN: opt %s -instcombine -S | grep load
11
22 define void @test(i32* %P) {
33 ; Dead but not deletable!
0 ; The cast in this testcase is not eliminable on a 32-bit target!
1 ; RUN: opt %s -instcombine | llvm-dis | grep inttoptr
1 ; RUN: opt %s -instcombine -S | grep inttoptr
22
33 target datalayout = "e-p:32:32"
44
None ; RUN: opt %s -instcombine | llvm-dis | grep call | notcast
0 ; RUN: opt %s -instcombine -S | grep call | notcast
11
22 declare void @free(i8*)
33
None ; RUN: opt %s -instcombine | llvm-dis | not grep 34
0 ; RUN: opt %s -instcombine -S | not grep 34
11
22 define i32 @test(i32 %X) {
33 ; Do not fold into shr X, 34, as this uses undefined behavior!
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: grep {ret i1 false}
22
33 define i1 @test(i1 %V) {
None ; RUN: opt %s -instcombine -mem2reg | llvm-dis | \
0 ; RUN: opt %s -instcombine -mem2reg -S | \
11 ; RUN: not grep {i32 1}
22
33 ; When propagating the load through the select, make sure that the load is
None ; RUN: opt %s -instcombine | llvm-dis | not grep -- -65536
0 ; RUN: opt %s -instcombine -S | not grep -- -65536
11
22 define i1 @test(i32 %tmp.124) {
33 %tmp.125 = shl i32 %tmp.124, 8 ; [#uses=1]
None ; RUN: opt %s -instcombine | llvm-dis | not grep and
0 ; RUN: opt < %s -instcombine -S | not grep and
11
22 define i8 @test21(i8 %A) {
33 ;; sign extend
88 ; be eliminated. In many cases the setCC is also eliminated based on the
99 ; constant value and the range of the casted value.
1010 ;
11 ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
11 ; RUN: llvm-as %s -o - | opt -instcombine -S | \
1212 ; RUN: notcast .*int
1313 ; END.
1414 define i1 @lt_signed_to_large_unsigned(i8 %SB) {
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: not grep {ret i1 false}
22
33 define i1 @test(i64 %tmp.169) {
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: grep {ret i1 true}
22 ; PR586
33
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: not grep undef
22
33 define i32 @test(i8 %A) {
None ; RUN: opt %s -instcombine | llvm-dis | grep shl
1 ; RUN: opt %s -instcombine | llvm-dis | notcast
0 ; RUN: opt %s -instcombine -S | grep shl
1 ; RUN: opt %s -instcombine -S | notcast
22
33 ; This cannot be turned into a sign extending cast!
44
None ; RUN: opt %s -instcombine | llvm-dis | grep and
0 ; RUN: opt %s -instcombine -S | grep and
11 ; PR913
22
33 define i32 @test(i32* %tmp1) {
0 ; The optimizer should be able to remove cast operation here.
1 ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
1 ; RUN: llvm-as %s -o - | opt -instcombine -S | \
22 ; RUN: not grep sext.*i32
33
44 define i1 @eq_signed_to_small_unsigned(i8 %SB) {
0 ; This test case is reduced from llvmAsmParser.cpp
11 ; The optimizer should not remove the cast here.
2 ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
2 ; RUN: llvm-as %s -o - | opt -instcombine -S | \
33 ; RUN: grep sext.*i32
44
55
None ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
0 ; RUN: llvm-as %s -o - | opt -instcombine -S | \
11 ; RUN: grep and
22
33 define i64 @foo(i64 %tmp, i64 %tmp2) {
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: grep mul | count 2
22
33 define <4 x float> @test(<4 x float> %V) {
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: not grep memmove.i32
22 ; Instcombine was trying to turn this into a memmove.i32
33
None ; RUN: opt %s -instcombine | llvm-dis | grep lshr
0 ; RUN: opt %s -instcombine -S | grep lshr
11 ; Verify this is not turned into -1.
22
33 define i32 @test(i8 %amt) {
None ; RUN: opt %s -instcombine | llvm-dis | grep and.*32
1 ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | grep and.*32
1 ; RUN: opt %s -instcombine -S | \
22 ; RUN: not grep or.*153
33 ; PR1014
44
None ; RUN: opt %s -instcombine | llvm-dis | grep sub
1 ; RUN: opt %s -instcombine | llvm-dis | grep add
0 ; RUN: opt %s -instcombine -S | grep sub
1 ; RUN: opt %s -instcombine -S | grep add
22
33 define <4 x float> @test(<4 x float> %tmp26, <4 x float> %tmp53) {
44 ; (X+Y)-Y != X for fp vectors.
None ; RUN: opt %s -instcombine | llvm-dis | grep zext
0 ; RUN: opt %s -instcombine -S | grep zext
11
22 ; Never merge these two conversions, even though it's possible: this is
33 ; significantly more expensive than the two conversions on some targets
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: grep {%bothcond =}
22
33 define i1 @Doit_bb(i32 %i.0) {
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: grep {icmp sgt}
22 ; END.
33 target datalayout = "e-p:32:32"
None ; RUN: opt %s -instcombine | llvm-dis | grep select
0 ; RUN: opt %s -instcombine -S | grep select
11 ; END.
22
33 target datalayout = "e-p:32:32"
None ; RUN: opt %s -instcombine | llvm-dis | \
0 ; RUN: opt %s -instcombine -S | \
11 ; RUN: grep icmp | count 1
2 ; RUN: opt %s -instcombine | llvm-dis | \
2 ; RUN: opt %s -instcombine -S | \
33 ; RUN: grep {icmp ugt} | count 1
44 ; END.
55
None ; RUN: opt %s -instcombine | llvm-dis | grep {icmp ugt}
0 ; RUN: opt %s -instcombine -S | grep {icmp ugt}
11 ; PR1107
22 ; PR1940
33
None ; RUN: opt %s -instcombine | llvm-dis | grep {fcmp uno.*0.0}
0 ; RUN: opt %s -instcombine -S | grep {fcmp uno.*0.0}
11 ; PR1111
22 define i1 @test(double %X) {
33 %tmp = fcmp une double %X, %X
None ; RUN: opt %s -instcombine | llvm-dis | grep {ugt.*, 1}
0 ; RUN: opt %s -instcombine -S | grep {ugt.*, 1}
11
22 define i1 @test(i32 %tmp1030) {
33 %tmp1037 = icmp ne i32 %tmp1030, 40 ; [#uses=1]
None ; RUN: opt %s -instcombine -mem2reg | llvm-dis | grep {%A = alloca}
1 ; RUN: opt %s -instcombine -mem2reg | llvm-dis | \
0 ; RUN: opt %s -instcombine -mem2reg -S | grep {%A = alloca}
1 ; RUN: opt %s -instcombine -mem2reg -S | \
22 ; RUN: not grep {%B = alloca}
33 ; END.
44
None ;RUN: opt %s -instcombine | llvm-dis | grep zext
0 ;RUN: opt %s -instcombine -S | grep zext
11
22 ; Make sure the uint isn't removed. Instcombine in llvm 1.9 was dropping the
33 ; uint cast which was causing a sign extend. This only affected code with
None ; RUN: opt %s -instcombine | llvm-dis | grep ret
0 ; RUN: opt %s -instcombine -S | grep ret
11 ; PR1217
22
33 target datalayout = "e-p:32:32"
None ; RUN: opt %s -instcombine | llvm-dis | grep {icmp sle}
0 ; RUN: opt %s -instcombine -S | grep {icmp sle}
11 ; PR1244
22
33 define i1 @test(i32 %c.3.i, i32 %d.292.2.i) {
None ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep zext
0 ; RUN: llvm-as %s -o - | opt -instcombine -S | grep zext
11 ; PR1261.
22
33 define i16 @test(i31 %zzz) {
0 ; For PR1248
1 ; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep {ugt i32 .*, 11}
1 ; RUN: llvm-as %s -o - | opt -instcombine -S | grep {ugt i32 .*, 11}
22 define i1 @test(i32 %tmp6) {
33 %tmp7 = sdiv i32 %tmp6, 12 ; [#uses=1]
44 icmp ne i32 %tmp7, -6 ; :1 [#uses=1]
0 ; PR1271
1 ; RUN: opt %s -instcombine | llvm-dis | \
1 ; RUN: opt %s -instcombine -S | \
22 ; RUN: grep {icmp eq i32 .tmp.*, 2146435072}
33 %struct..0anon = type { i32, i32 }
44 %struct..1anon = type { double }
0 ; PR1271
1 ; RUN: opt %s -instcombine | llvm-dis | grep and
1 ; RUN: opt %s -instcombine -S | grep and
22 define i1 @test(i32 %tmp13) {
33 entry:
44 %tmp14 = shl i32 %tmp13, 12 ; [#uses=1]
0 ; PR1271
1 ; RUN: opt %s -instcombine | llvm-dis | \
1 ; RUN: opt %s -instcombine -S | \
22 ; RUN: grep {ashr i32 %.mp137, 2}
33 ; END.
44
33 ; is not done. It should be removed when code gen supports "funny"
44 ; bit widths.
55
6 ; RUN: opt %s -instcombine | llvm-dis | grep {add i49.*-8388608}
6 ; RUN: opt %s -instcombine -S | grep {add i49.*-8388608}
77
88 define i49 @test5(i49 %x) {
99 ;; If we have ADD(XOR(AND(X, 0xFF), 0x80), 0xF..F80), it's a sext.
11 ; a malloc messes up the element count, causing an extra 4GB to be allocated on
22 ; 64-bit targets.
33 ;
4 ; RUN: opt %s -instcombine | llvm-dis | not grep {= add }
4 ; RUN: opt %s -instcombine -S | not grep {= add }
55
66 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"
77 target triple = "x86_64-unknown-freebsd6.2"
None ; RUN: opt %s -instcombine | llvm-dis | grep {call.*sret}
0 ; RUN: opt %s -instcombine -S | grep {call.*sret}
11 ; Make sure instcombine doesn't drop the sret attribute.
22
33 define void @blah(i16* %tmp10) {
None ; RUN: opt %s -instcombine | llvm-dis | grep {ashr}
0 ; RUN: opt %s -instcombine -S | grep {ashr}
11 ; PR1499
22
33 define void @av_cmp_q_cond_true(i32* %retval, i32* %tmp9, i64* %tmp10) {
None ; RUN: opt %s -instcombine | llvm-dis | grep {ret i1 true}
0 ; RUN: opt %s -instcombine -S | grep {ret i1 true}
11 ; rdar://5278853
22
33 define i1 @test(i32 %tmp468) {
None ; RUN: opt %s -instcombine | llvm-dis | grep icmp
0 ; RUN: opt %s -instcombine -S | grep icmp
11 ; PR1646
22
33 @__gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel ; [#uses=1]
None ; RUN: opt %s -instcombine | llvm-dis | grep {call i32 @f}
0 ; RUN: opt %s -instcombine -S | grep {call i32 @f}
11
22 %struct.FRAME.nest = type { i32, i32 (i32)* }
33 %struct.__builtin_trampoline = type { [10 x i8] }
None ; RUN: opt %s -instcombine | llvm-dis | grep icmp
0 ; RUN: opt %s -instcombine -S | grep icmp
11 ; PR1678
22
33 @A = alias weak void ()* @B ; [#uses=1]
None ; RUN: opt %s -instcombine | llvm-dis | not grep call
1 ; RUN: opt %s -std-compile-opts | llvm-dis | not grep xyz
0 ; RUN: opt %s -instcombine -S | not grep call
1 ; RUN: opt %s -std-compile-opts -S | not grep xyz
22
33 @.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1]
44
None ; RUN: opt %s -instcombine | llvm-dis | grep {call.*stacksave}
0 ; RUN: opt %s -instcombine -S | grep {call.*stacksave}
11 ; PR1745
22 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-f80:128:128"
33 target triple = "i686-apple-darwin8"
None ; RUN: opt %s -instcombine | llvm-dis | grep {icmp eq i32 %In, 1}
0 ; RUN: opt %s -instcombine -S | grep {icmp eq i32 %In, 1}
11 ; PR1800
22
33 define i1 @test(i32 %In) {
None ; RUN: opt %s -instcombine | llvm-dis | not grep bitcast
0 ; RUN: opt %s -instcombine -S | not grep bitcast
11 ; PR1716
22
33 @.str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
0 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-f80:32:32"
11 target triple = "i686-pc-linux-gnu"
2 ; RUN: opt %s -instcombine | llvm-dis | not grep {ret i1 0}
2 ; RUN: opt %s -instcombine -S | not grep {ret i1 0}
33 ; PR1850
44
55 define i1 @test() {
None ; RUN: opt %s -instcombine | llvm-dis | not grep 1431655764
0 ; RUN: opt %s -instcombine -S | not grep 1431655764
11
22 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-f80:32:32"
33
None ; RUN: opt %s -instcombine | llvm-dis | grep nounwind
0 ; RUN: opt %s -instcombine -S | grep nounwind
11
22 define void @bar() {
33 entry:
None ; RUN: opt %s -instcombine | llvm-dis | grep {add} | count 1
0 ; RUN: opt %s -instcombine -S | grep {add} | count 1
11
22 define i32 @foo(i32 %a) {
33 entry:
None ; RUN: opt %s -mem2reg -instcombine | llvm-dis | grep "ret i32 1" | count 8
0 ; RUN: opt %s -mem2reg -instcombine -S | grep "ret i32 1" | count 8
11
22 define i32 @test1() {
33 entry:
0 ; Ignore stderr, we expect warnings there
1 ; RUN: opt %s -instcombine 2> /dev/null | llvm-dis | not grep bitcast
1 ; RUN: opt %s -instcombine 2> /dev/null -S | not grep bitcast
22
33 define void @a() {
44 ret void
None ; RUN: opt %s -instcombine | llvm-dis | not grep bitcast
0 ; RUN: opt %s -instcombine -S | not grep bitcast
11
22 define void @f(i16 %y) {
33 ret void
None ; RUN: opt %s -instcombine | llvm-dis | grep and
0 ; RUN: opt %s -instcombine -S | grep and
11 ; PR1907
22
33 define i1 @test(i32 %c84.17) {
None ; RUN: opt %s -instcombine | llvm-dis | grep bitcast | count 2
0 ; RUN: opt %s -instcombine -S | grep bitcast | count 2
11
22 define i32 @b(i32* inreg %x) signext {
33 ret i32 0
None ; RUN: opt %s -instcombine | llvm-dis | grep zeroext
0 ; RUN: opt %s -instcombine -S | grep zeroext
11
22 %struct.FRAME.nest = type { i32, i32 (...)* }
33 %struct.__builtin_trampoline = type { [10 x i8] }
None ; RUN: opt %s -instcombine | llvm-dis | notcast
1 ; RUN: opt %s -instcombine | llvm-dis | not grep {icmp s}
0 ; RUN: opt %s -instcombine -S | notcast
1 ; RUN: opt %s -instcombine -S | not grep {icmp s}
22 ; PR1940
33
44 define i1 @test1(i8 %A, i8 %B) {
None ; RUN: opt %s -instcombine | llvm-dis | notcast
0 ; RUN: opt %s -instcombine -S | notcast
11
22 define i16 @test1(i16 %a) {
33 %tmp = zext i16 %a to i32 ; [#uses=2]
None ; RUN: opt %s -instcombine | llvm-dis | grep select
0 ; RUN: opt %s -instcombine -S | grep select
11
22 define double @fold(i1 %a, double %b) {
33 %s = select i1 %a, double 0., double 1.
None ; RUN: opt %s -instcombine | llvm-dis | not grep {a.off}
0 ; RUN: opt %s -instcombine -S | not grep {a.off}
11 ; PR1949
22
33 define i1 @test1(i32 %a) {
None ; RUN: opt %s -instcombine | llvm-dis | grep rem
0 ; RUN: opt %s -instcombine -S | grep rem
11 ; PR1933
22
33 define i32 @fold(i32 %a) {
None ; RUN: opt %s -instcombine | llvm-dis | grep {ret i.* 0} | count 2
0 ; RUN: opt %s -instcombine -S | grep {ret i.* 0} | count 2
11 ; PR2048
22
33 define i32 @i(i32 %a) {
None ; RUN: opt %s -instcombine | llvm-dis | grep {sdiv i8 \%a, 9}
0 ; RUN: opt %s -instcombine -S | grep {sdiv i8 \%a, 9}
11 ; PR2048
22
33 define i8 @i(i8 %a) {
None ; RUN: opt %s -instcombine | llvm-dis | not grep mul
0 ; RUN: opt %s -instcombine -S | not grep mul
11
22 define i26 @test(i26 %a) nounwind {
33 entry:
None ; RUN: opt %s -instcombine | llvm-dis | grep {16} | count 1
0 ; RUN: opt %s -instcombine -S | grep {16} | count 1
11
22 define i8* @bork(i8** %qux) {
33 %tmp275 = load i8** %qux, align 1
0 ;; The bitcast cannot be eliminated because byval arguments need
11 ;; the correct type, or at least a type of the correct size.
2 ; RUN: opt %s -instcombine | llvm-dis | grep bitcast
2 ; RUN: opt %s -instcombine -S | grep bitcast
33 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-f80:128:128"
44 target triple = "i386-apple-darwin9"
55 %struct.NSRect = type { [4 x float] }
None ; RUN: opt %s -instcombine | llvm-dis | grep {volatile store}
0 ; RUN: opt %s -instcombine -S | grep {volatile store}
11
22 define void @test() {
33 %votf = alloca <4 x float> ; <<4 x float>*> [#uses=1]
None ; RUN: opt %s -instcombine | llvm-dis | grep {volatile load} | count 2
0 ; RUN: opt %s -instcombine -S | grep {volatile load} | count 2
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-f80:128:128"
22 target triple = "i386-apple-darwin8"
33 @g_1 = internal global i32 0 ; [#uses=3]
None ; RUN: opt %s -instcombine | llvm-dis | grep {volatile load} | count 2
0 ; RUN: opt %s -instcombine -S | grep {volatile load} | count 2
11 ; PR2262
22 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-f80:128:128"
33 target triple = "i386-apple-darwin8"
None ; RUN: opt %s -instcombine | llvm-dis | grep {store i8} | count 3
0 ; RUN: opt %s -instcombine -S | grep {store i8} | count 3
11 ; PR2297
22 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-f80:128:128"
33 target triple = "i386-apple-darwin8"
None ; RUN: opt %s -instcombine | llvm-dis | grep {ret i1 false} | count 2
0 ; RUN: opt %s -instcombine -S | grep {ret i1 false} | count 2
11 ; PR2329
22
33 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-f80:32:32"
None ; RUN: opt %s -instcombine | llvm-dis | not grep sub
0 ; RUN: opt %s -instcombine -S | not grep sub
11
22 define <3 x i8> @f(<3 x i8> %a) {
33 %A = sub <3 x i8> zeroinitializer, %a
None ; RUN: opt %s -instcombine | llvm-dis | grep {ret i1 false}
0 ; RUN: opt %s -instcombine -S | grep {ret i1 false}
11 ; PR2359
22 define i1 @f(i8* %x) {
33 entry:
None ; RUN: opt %s -instcombine | llvm-dis | grep {xor}
0 ; RUN: opt %s -instcombine -S | grep {xor}
11 ; PR2389
22
33 define i1 @test(i1 %a, i1 %b) {
None ; RUN: opt %s -instcombine | llvm-dis > %t
0 ; RUN: opt %s -instcombine -S > %t
11 ; RUN: grep {xor} %t
22 ; RUN: grep {and} %t
33 ; RUN: not grep {div} %t
None ; RUN: opt %s -instcombine | llvm-dis | grep {phi i32} | count 2
0 ; RUN: opt %s -instcombine -S | grep {phi i32} | count 2
11
22 define void @test() nounwind {
33 entry:
None ; RUN: opt %s -instcombine | llvm-dis | grep {store i32} | count 2
0 ; RUN: opt %s -instcombine -S | grep {store i32} | count 2
11
22 @g_139 = global i32 0 ; [#uses=2]
33
None ; RUN: opt %s -instcombine | llvm-dis | grep {store i8} | count 2
0 ; RUN: opt %s -instcombine -S | grep {store i8} | count 2
11
22 define i32 @a(i8* %s) nounwind {
33 entry:
None ; RUN: opt %s -instcombine | llvm-dis | grep load | count 3
0 ; RUN: opt %s -instcombine -S | grep load | count 3
11 ; PR2471
22
33 declare i32 @x(i32*)
None ; RUN: opt %s -instcombine | llvm-dis | grep {icmp eq i32 %In, 15}
0 ; RUN: opt %s -instcombine -S | grep {icmp eq i32 %In, 15}
11 ; PR2479
22 ; (See also PR1800.)
33
None ; RUN: opt %s -instcombine | llvm-dis | grep {call.*llvm.stackrestore}
0 ; RUN: opt %s -instcombine -S | grep {call.*llvm.stackrestore}
11 ; PR2488
22 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-f80:32:32"
33 target triple = "i386-pc-linux-gnu"
None ; RUN: opt %s -instcombine | llvm-dis | grep icmp | count 1
0 ; RUN: opt %s -instcombine -S | grep icmp | count 1
11 ; PR2330
22
33 define i1 @foo(i32 %a, i32 %b) nounwind {
None ; RUN: opt %s -instcombine | llvm-dis | grep {icmp ne i32 \%a}
0 ; RUN: opt %s -instcombine -S | grep {icmp ne i32 \%a}
11 ; PR2330
22
33 define i1 @foo(i32 %a) nounwind {
None ; RUN: opt %s -instcombine | llvm-dis | grep -v {i32 8}
0 ; RUN: opt %s -instcombine -S | grep -v {i32 8}
11 ; PR2330
22
33 define i32 @a(i32 %a) nounwind {
None ; RUN: opt %s -instcombine | llvm-dis | grep {volatile load} | count 2
0 ; RUN: opt %s -instcombine -S | grep {volatile load} | count 2
11 ; PR2496
22 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-f80:128:128"
33 target triple = "i386-apple-darwin8"
None ; RUN: opt %s -instcombine | llvm-dis | not grep {sub i32 0}
0 ; RUN: opt %s -instcombine -S | not grep {sub i32 0}
11 ; PR2330
22
33 define i32 @foo(i32 %a) nounwind {
None ; RUN: opt %s -instcombine | llvm-dis | grep {%C = xor i1 %A, true}
1 ; RUN: opt %s -instcombine | llvm-dis | grep {ret i1 false}
0 ; RUN: opt %s -instcombine -S | grep {%C = xor i1 %A, true}
1 ; RUN: opt %s -instcombine -S | grep {ret i1 false}
22 ; PR2539
33
44 define i1 @test1(i1 %A) {
None ; RUN: opt %s -instcombine | llvm-dis | not grep add
1 ; RUN: opt %s -instcombine | llvm-dis | not grep mul
0 ; RUN: opt %s -instcombine -S | not grep add
1 ; RUN: opt %s -instcombine -S | not grep mul
2