Debian Codegraph @

llvm/test/Transforms/ConstantHoisting/X86/ehpad.ll

raw
1 ; RUN: opt -S -passes=consthoist -consthoist-with-block-frequency=false < %s | FileCheck %s
2 ; RUN: opt -S -passes=consthoist -consthoist-with-block-frequency=true < %s | FileCheck --check-prefix=BFIHOIST %s
3
4 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-pc-windows-msvc"
6
7 ; CHECK-LABEL: define i32 @main
8 ; CHECK: %tobool = icmp eq i32 %argc, 0
9 ; CHECK-NEXT: bitcast i64 9209618997431186100 to i64
10 ; CHECK-NEXT: br i1 %tobool
11
12 ; BFIHOIST-LABEL: define i32 @main
13 ; BFIHOIST: then:
14 ; BFIHOIST: %[[CONST1:.*]] = bitcast i64 9209618997431186100 to i64
15 ; BFIHOIST: %add = add i64 %call4, %[[CONST1]]
16 ; BFIHOIST: br label %endif
17 ; BFIHOIST: else:
18 ; BFIHOIST: %[[CONST2:.*]] = bitcast i64 9209618997431186100 to i64
19 ; BFIHOIST: %add6 = add i64 %call5, %[[CONST2]]
20 ; BFIHOIST: br label %endif
21
22 ; Function Attrs: norecurse
23 define i32 @main(i32 %argc, ptr nocapture readnone %argv) local_unnamed_addr personality ptr @__CxxFrameHandler3 {
24 %call = tail call i64 @fn(i64 0)
25 %call1 = tail call i64 @fn(i64 1)
26 %tobool = icmp eq i32 %argc, 0
27 br i1 %tobool, label %2, label %1
28
29 ; <label>:1: ; preds = %0
30 %call2 = invoke i64 @fn(i64 %call)
31 to label %6 unwind label %catch.dispatch
32
33 ; <label>:2: ; preds = %0
34 %call3 = invoke i64 @fn(i64 %call1)
35 to label %6 unwind label %catch.dispatch
36
37 catch.dispatch: ; preds = %2, %1
38 %z.0 = phi i64 [ %call, %1 ], [ %call1, %2 ]
39 %3 = catchswitch within none [label %4] unwind to caller
40
41 ; <label>:4: ; preds = %catch.dispatch
42 %5 = catchpad within %3 [ptr null, i32 64, ptr null]
43 br i1 %tobool, label %then, label %else
44
45 then:
46 %call4 = tail call i64 @fn(i64 %z.0) [ "funclet"(token %5) ]
47 %add = add i64 %call4, 9209618997431186100
48 br label %endif
49
50 else:
51 %call5 = tail call i64 @fn(i64 0) [ "funclet"(token %5) ]
52 %add6 = add i64 %call5, 9209618997431186100
53 br label %endif
54
55 endif:
56 %v = phi i64 [ %add, %then ], [ %add6, %else ]
57 %call7 = tail call i64 @fn(i64 %v) [ "funclet"(token %5) ]
58 %call8 = tail call i64 @fn(i64 %call7) [ "funclet"(token %5) ]
59 catchret from %5 to label %6
60
61 ; <label>:6: ; preds = %1, %2, %4
62 ret i32 0
63 }
64
65 declare i64 @fn(i64) local_unnamed_addr
66
67 declare i32 @__CxxFrameHandler3(...)