llvm.org GIT mirror llvm / 9ed78ae
[ArgPromote] Clean up a crash test case by rinsing it through opt, renaming things to at least have somewhat spelled out names, and even have meaningful names where I could guess at what they should be. Also add FileCheck assertions that we're actually doing what we set out to do for some of the tests, for example not promoting a type that would result in infinite promotion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294426 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 2 years ago
1 changed file(s) with 46 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
None ; RUN: opt -inline -argpromotion < %s
1 ; rdar://7879828
0 ; RUN: opt -S < %s -inline -argpromotion | FileCheck %s
21
3 define void @foo() personality i32 (...)* @__gxx_personality_v0 {
4 invoke void @foo2()
5 to label %if.end432 unwind label %for.end520
2 %S = type { %S* }
63
7 if.end432:
4 ; Inlining should nuke the invoke (and any inlined calls) here even with
5 ; argument promotion running along with it.
6 define void @zot() personality i32 (...)* @wibble {
7 ; CHECK-LABEL: define void @zot() personality i32 (...)* @wibble
8 ; CHECK-NOT: call
9 ; CHECK-NOT: invoke
10 bb:
11 invoke void @hoge()
12 to label %bb1 unwind label %bb2
13
14 bb1:
815 unreachable
916
10 for.end520:
11 %exn = landingpad {i8*, i32}
12 cleanup
17 bb2:
18 %tmp = landingpad { i8*, i32 }
19 cleanup
1320 unreachable
1421 }
1522
16 define internal void @foo2() ssp {
17 %call7 = call fastcc i8* @foo3(i1 (i8*)* @foo4)
18 %call58 = call fastcc i8* @foo3(i1 (i8*)* @foo5)
23 define internal void @hoge() {
24 bb:
25 %tmp = call fastcc i8* @spam(i1 (i8*)* @eggs)
26 %tmp1 = call fastcc i8* @spam(i1 (i8*)* @barney)
1927 unreachable
2028 }
2129
22 define internal fastcc i8* @foo3(i1 (i8*)* %Pred) {
23 entry:
30 define internal fastcc i8* @spam(i1 (i8*)* %arg) {
31 bb:
2432 unreachable
2533 }
2634
27 define internal i1 @foo4(i8* %O) nounwind {
28 entry:
29 %call = call zeroext i1 @foo5(i8* %O) ; [#uses=0]
35 define internal i1 @eggs(i8* %arg) {
36 bb:
37 %tmp = call zeroext i1 @barney(i8* %arg)
3038 unreachable
3139 }
3240
33 define internal i1 @foo5(i8* %O) nounwind {
34 entry:
41 define internal i1 @barney(i8* %arg) {
42 bb:
3543 ret i1 undef
3644 }
3745
46 define i32 @test_inf_promote_caller(i32 %arg) {
47 ; CHECK-LABEL: define i32 @test_inf_promote_caller(
48 bb:
49 %tmp = alloca %S
50 %tmp1 = alloca %S
51 %tmp2 = call i32 @test_inf_promote_callee(%S* %tmp, %S* %tmp1)
52 ; CHECK: call i32 @test_inf_promote_callee(%S* %{{.*}}, %S* %{{.*}})
3853
39 ; PR8932 - infinite promotion.
40 %0 = type { %0* }
41
42 define i32 @test2(i32 %a) {
43 init:
44 %0 = alloca %0
45 %1 = alloca %0
46 %2 = call i32 @"clay_assign(Chain, Chain)"(%0* %0, %0* %1)
4754 ret i32 0
4855 }
4956
50 define internal i32 @"clay_assign(Chain, Chain)"(%0* %c, %0* %d) {
51 init:
52 %0 = getelementptr %0, %0* %d, i32 0, i32 0
53 %1 = load %0*, %0** %0
54 %2 = getelementptr %0, %0* %c, i32 0, i32 0
55 %3 = load %0*, %0** %2
56 %4 = call i32 @"clay_assign(Chain, Chain)"(%0* %3, %0* %1)
57 define internal i32 @test_inf_promote_callee(%S* %arg, %S* %arg1) {
58 ; CHECK-LABEL: define internal i32 @test_inf_promote_callee(
59 ; CHECK: %S* %{{.*}}, %S* %{{.*}})
60 bb:
61 %tmp = getelementptr %S, %S* %arg1, i32 0, i32 0
62 %tmp2 = load %S*, %S** %tmp
63 %tmp3 = getelementptr %S, %S* %arg, i32 0, i32 0
64 %tmp4 = load %S*, %S** %tmp3
65 %tmp5 = call i32 @test_inf_promote_callee(%S* %tmp4, %S* %tmp2)
66 ; CHECK: call i32 @test_inf_promote_callee(%S* %{{.*}}, %S* %{{.*}})
67
5768 ret i32 0
5869 }
5970
60 declare i32 @__gxx_personality_v0(...)
71 declare i32 @wibble(...)