1cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -S | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christopher; Function Attrs: nounwind uwtable
4cee313d2SEric Christopherdefine dso_local i8* @bar(i32 %arg) local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
5cee313d2SEric Christopherbb:
6cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0
7cee313d2SEric Christopher  br i1 %tmp, label %bb1, label %bb5
8cee313d2SEric Christopher
9cee313d2SEric Christopherbb1:                                              ; preds = %bb
10cee313d2SEric Christopher  %call26 = invoke i8* @invoke_callee() #2
11cee313d2SEric Christopher          to label %cont unwind label %lpad
12cee313d2SEric Christopherlpad:                                            ; preds = %if.end
13cee313d2SEric Christopher  %0 = landingpad { i8*, i32 }
14cee313d2SEric Christopher         cleanup
15cee313d2SEric Christopher  resume { i8*, i32 } undef
16cee313d2SEric Christopher
17cee313d2SEric Christophercont:
18cee313d2SEric Christopher    br label %bb5
19cee313d2SEric Christopher
20cee313d2SEric Christopherbb5:                                              ; preds = %bb4, %bb1, %bb
21cee313d2SEric Christopher  %retval = phi i8* [ %call26, %cont ], [ undef, %bb]
22cee313d2SEric Christopher  ret i8* %retval
23cee313d2SEric Christopher}
24cee313d2SEric Christopher
25cee313d2SEric Christopher; CHECK-LABEL: @dummy_caller
26cee313d2SEric Christopher; CHECK-LABEL: bb:
27cee313d2SEric Christopher; CHECK-NEXT:  [[CALL26LOC:%.*]] = alloca i8*
28cee313d2SEric Christopher; CHECK-LABEL: codeRepl.i:
29*099bffe7SVedant Kumar; CHECK-NEXT:   %lt.cast.i = bitcast i8** [[CALL26LOC]] to i8*
30*099bffe7SVedant Kumar; CHECK-NEXT:   call void @llvm.lifetime.start.p0i8(i64 -1, i8* %lt.cast.i)
31cee313d2SEric Christopher; CHECK-NEXT:   call void @bar.1.bb1(i8** [[CALL26LOC]])
32cee313d2SEric Christopher; CHECK-NEXT:   %call26.reload.i = load i8*, i8** [[CALL26LOC]]
33*099bffe7SVedant Kumar; CHECK-NEXT:   call void @llvm.lifetime.end.p0i8(i64 -1, i8* %lt.cast.i)
34cee313d2SEric Christopherdefine i8* @dummy_caller(i32 %arg) {
35cee313d2SEric Christopherbb:
36cee313d2SEric Christopher  %tmp = tail call i8* @bar(i32 %arg)
37cee313d2SEric Christopher  ret i8* %tmp
38cee313d2SEric Christopher}
39cee313d2SEric Christopher
40cee313d2SEric Christopher; CHECK-LABEL: define internal void @bar.1.bb1
41cee313d2SEric Christopher; CHECK-LABEL: bb1:
42cee313d2SEric Christopher; CHECK-NEXT:    %call26 = invoke i8* @invoke_callee()
43cee313d2SEric Christopher; CHECK-NEXT:            to label %cont unwind label %lpad
44cee313d2SEric Christopher; CHECK-LABEL: cont:
45cee313d2SEric Christopher; CHECK-NEXT:    store i8* %call26, i8** %call26.out
46cee313d2SEric Christopher; CHECK-NEXT:    br label %bb5.exitStub
47cee313d2SEric Christopher
48cee313d2SEric Christopher; Function Attrs: nobuiltin
49cee313d2SEric Christopherdeclare dso_local noalias nonnull i8* @invoke_callee() local_unnamed_addr #1
50cee313d2SEric Christopher
51cee313d2SEric Christopherdeclare dso_local i32 @__gxx_personality_v0(...)
52