1 ; RUN: opt -S -passes=instcombine < %s | FileCheck -enable-var-scope %s
3 ; Check that instcombine preserves !prof metadata when removing function
6 declare i32 @__gxx_personality_v0(...)
7 declare void @__cxa_call_unexpected(ptr)
8 declare void @foo(ptr %a)
10 ; CHECK-LABEL: @test_call()
11 ; CHECK: call void @foo(ptr null), !prof ![[$PROF:[0-9]+]]
12 define void @test_call() {
13 call void @foo (ptr null), !prof !0
17 ; CHECK-LABEL: @test_invoke()
18 ; CHECK: invoke void @foo(ptr null)
19 ; CHECK-NEXT: to label %done unwind label %lpad, !prof ![[$PROF]]
20 define void @test_invoke() personality ptr @__gxx_personality_v0 {
21 invoke void @foo (ptr null)
22 to label %done unwind label %lpad, !prof !0
28 %lp = landingpad { ptr, i32 }
29 filter [0 x ptr] zeroinitializer
30 %ehptr = extractvalue { ptr, i32 } %lp, 0
31 tail call void @__cxa_call_unexpected(ptr %ehptr) noreturn nounwind
35 ; CHECK: ![[$PROF]] = !{!"VP", i32 0, i64 2000, i64 -3913987384944532146, i64 2000}
36 !0 = !{!"VP", i32 0, i64 2000, i64 -3913987384944532146, i64 2000}
38 !llvm.module.flags = !{!1}
40 !1 = !{i32 1, !"ProfileSummary", !2}
41 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
42 !3 = !{!"ProfileFormat", !"InstrProf"}
43 !4 = !{!"TotalCount", i64 10000}
44 !5 = !{!"MaxCount", i64 1000}
45 !6 = !{!"MaxInternalCount", i64 1}
46 !7 = !{!"MaxFunctionCount", i64 1000}
47 !8 = !{!"NumCounts", i64 3}
48 !9 = !{!"NumFunctions", i64 3}
49 !10 = !{!"DetailedSummary", !11}
50 !11 = !{!12, !13, !14}
51 !12 = !{i32 10000, i64 1000, i32 1}
52 !13 = !{i32 999000, i64 1000, i32 1}
53 !14 = !{i32 999999, i64 1, i32 2}