• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -icp-lto -pgo-icall-prom -S | FileCheck %s --check-prefix=ICP
2target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-unknown-linux-gnu"
4
5@_ZTISt9exception = external constant i8*
6@pfptr = global i32()* null, align 8
7
8define internal i32 @_ZL4bar1v() !PGOFuncName !0 {
9entry:
10  ret i32 100
11}
12
13; Function Attrs: uwtable
14define i32 @_Z3fooi(i32 %x) local_unnamed_addr personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
15entry:
16  %tobool = icmp eq i32 %x, 0
17  br i1 %tobool, label %if.end, label %cleanup
18
19if.end:                                           ; preds = %entry
20  %fptr = load i32 ()*, i32 ()** @pfptr, align 8
21; ICP:  [[CMP_IC1:%[0-9]+]] = icmp eq i32 ()* %fptr, @_ZL4bar1v
22; ICP:  br i1 [[CMP_IC1]], label %[[TRUE_LABEL_IC1:.*]], label %[[FALSE_LABEL_IC1:.*]], !prof [[BRANCH_WEIGHT:![0-9]+]]
23; ICP:[[TRUE_LABEL_IC1]]:
24; ICP:  invoke i32 @_ZL4bar1v()
25; ICP:          to label %[[DCALL_NORMAL_DEST_IC1:.*]] unwind label %lpad
26; ICP:[[FALSE_LABEL_IC1]]:
27  %call = invoke i32 %fptr()
28          to label %cleanup unwind label %lpad, !prof !1
29
30; ICP:[[DCALL_NORMAL_DEST_IC1]]:
31; ICP:  br label %cleanup
32
33lpad:                                             ; preds = %if.end
34  %0 = landingpad { i8*, i32 }
35          cleanup
36          catch i8* bitcast (i8** @_ZTISt9exception to i8*)
37  %1 = extractvalue { i8*, i32 } %0, 1
38  %2 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTISt9exception to i8*))
39  %matches = icmp eq i32 %1, %2
40  br i1 %matches, label %catch, label %ehcleanup
41
42catch:                                            ; preds = %lpad
43  %3 = extractvalue { i8*, i32 } %0, 0
44  %4 = tail call i8* @__cxa_begin_catch(i8* %3)
45  tail call void @__cxa_end_catch()
46  br label %cleanup
47
48cleanup:                                          ; preds = %catch, %if.end, %entry
49; ICP-NOT: %[0-9]+ = phi
50  ret i32 0
51
52ehcleanup:                                        ; preds = %lpad
53  resume { i8*, i32 } %0
54}
55
56declare i32 @_Z3barv() local_unnamed_addr
57
58declare i32 @__gxx_personality_v0(...)
59
60; Function Attrs: nounwind readnone
61declare i32 @llvm.eh.typeid.for(i8*)
62
63declare i8* @__cxa_begin_catch(i8*) local_unnamed_addr
64
65declare void @__cxa_end_catch() local_unnamed_addr
66
67!0 = !{!"invoke.ll:_ZL4bar1v"}
68!1 = !{!"VP", i32 0, i64 10000, i64 -2732222848796217051, i64 10000}
69