1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2 ; RUN: opt -S < %s -inline -argpromotion | FileCheck %s --check-prefix=ARGPROMOTION
3 ; RUN: opt -S < %s -passes=inline,argpromotion | FileCheck %s --check-prefixes=ARGPROMOTION,ALL_NEWPM
7 ; Inlining should nuke the invoke (and any inlined calls) here even with
8 ; argument promotion running along with it.
9 define void @zot() personality i32 (...)* @wibble {
10 ; ARGPROMOTION-LABEL: define {{[^@]+}}@zot() personality i32 (...)* @wibble
11 ; ARGPROMOTION-NEXT: bb:
12 ; ARGPROMOTION-NEXT: unreachable
13 ; ARGPROMOTION: hoge.exit:
14 ; ARGPROMOTION-NEXT: br label [[BB1:%.*]]
16 ; ARGPROMOTION-NEXT: unreachable
18 ; ARGPROMOTION-NEXT: [[TMP:%.*]] = landingpad { i8*, i32 }
19 ; ARGPROMOTION-NEXT: cleanup
20 ; ARGPROMOTION-NEXT: unreachable
24 to label %bb1 unwind label %bb2
30 %tmp = landingpad { i8*, i32 }
35 define internal void @hoge() {
37 %tmp = call fastcc i8* @spam(i1 (i8*)* @eggs)
38 %tmp1 = call fastcc i8* @spam(i1 (i8*)* @barney)
42 define internal fastcc i8* @spam(i1 (i8*)* %arg) {
47 define internal i1 @eggs(i8* %arg) {
48 ; ALL_NEWPM-LABEL: define {{[^@]+}}@eggs()
50 ; ALL_NEWPM-NEXT: unreachable
53 %tmp = call zeroext i1 @barney(i8* %arg)
57 define internal i1 @barney(i8* %arg) {
62 define i32 @test_inf_promote_caller(i32 %arg) {
63 ; ARGPROMOTION-LABEL: define {{[^@]+}}@test_inf_promote_caller
64 ; ARGPROMOTION-SAME: (i32 [[ARG:%.*]])
65 ; ARGPROMOTION-NEXT: bb:
66 ; ARGPROMOTION-NEXT: [[TMP:%.*]] = alloca [[S:%.*]]
67 ; ARGPROMOTION-NEXT: [[TMP1:%.*]] = alloca [[S]]
68 ; ARGPROMOTION-NEXT: [[TMP2:%.*]] = call i32 @test_inf_promote_callee(%S* [[TMP]], %S* [[TMP1]])
69 ; ARGPROMOTION-NEXT: ret i32 0
74 %tmp2 = call i32 @test_inf_promote_callee(%S* %tmp, %S* %tmp1)
79 define internal i32 @test_inf_promote_callee(%S* %arg, %S* %arg1) {
80 ; ARGPROMOTION-LABEL: define {{[^@]+}}@test_inf_promote_callee
81 ; ARGPROMOTION-SAME: (%S* [[ARG:%.*]], %S* [[ARG1:%.*]])
82 ; ARGPROMOTION-NEXT: bb:
83 ; ARGPROMOTION-NEXT: [[TMP:%.*]] = getelementptr [[S:%.*]], %S* [[ARG1]], i32 0, i32 0
84 ; ARGPROMOTION-NEXT: [[TMP2:%.*]] = load %S*, %S** [[TMP]]
85 ; ARGPROMOTION-NEXT: [[TMP3:%.*]] = getelementptr [[S]], %S* [[ARG]], i32 0, i32 0
86 ; ARGPROMOTION-NEXT: [[TMP4:%.*]] = load %S*, %S** [[TMP3]]
87 ; ARGPROMOTION-NEXT: [[TMP5:%.*]] = call i32 @test_inf_promote_callee(%S* [[TMP4]], %S* [[TMP2]])
88 ; ARGPROMOTION-NEXT: ret i32 0
91 %tmp = getelementptr %S, %S* %arg1, i32 0, i32 0
92 %tmp2 = load %S*, %S** %tmp
93 %tmp3 = getelementptr %S, %S* %arg, i32 0, i32 0
94 %tmp4 = load %S*, %S** %tmp3
95 %tmp5 = call i32 @test_inf_promote_callee(%S* %tmp4, %S* %tmp2)
100 declare i32 @wibble(...)