xref: /llvm-project/llvm/test/CodeGen/Hexagon/packetize-allocframe.ll (revision 2208c97c1bec2512d4e47b6223db6d95a7037956)
1; RUN: llc -mtriple=hexagon -O2 -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
2
3; The purpose of this test is to make sure that the packetizer is ignoring
4; CFI instructions while forming packet for allocframe. Refer to 7d7d99622
5; which replaced PROLOG_LABEL with CFI_INSTRUCTION.
6
7@g0 = external constant ptr
8
9; We used to emit:
10;      {
11;        allocframe(#0)
12;      }
13;      {
14;         r0 = #4
15; But we can put more instructions in the first packet.
16
17; CHECK:      {
18; CHECK-NEXT:   call f1
19; CHECK-NEXT:   r0 = #4
20; CHECK-NEXT:   allocframe(#0)
21; CHECK-NEXT: }
22
23define i32 @f0() personality ptr @f3 {
24b0:
25  %v0 = tail call ptr @f1(i32 4) #1
26  store i32 20, ptr %v0, align 4, !tbaa !0
27  invoke void @f2(ptr %v0, ptr @g0, ptr null) #2
28          to label %b4 unwind label %b1
29
30b1:                                               ; preds = %b0
31  %v2 = landingpad { ptr, i32 }
32          catch ptr @g0
33  %v3 = extractvalue { ptr, i32 } %v2, 1
34  %v4 = tail call i32 @llvm.eh.typeid.for(ptr @g0) #1
35  %v5 = icmp eq i32 %v3, %v4
36  br i1 %v5, label %b2, label %b3
37
38b2:                                               ; preds = %b1
39  %v6 = extractvalue { ptr, i32 } %v2, 0
40  %v7 = tail call ptr @f4(ptr %v6) #1
41  tail call void @f5() #1
42  ret i32 1
43
44b3:                                               ; preds = %b1
45  resume { ptr, i32 } %v2
46
47b4:                                               ; preds = %b0
48  unreachable
49}
50
51declare ptr @f1(i32)
52
53declare void @f2(ptr, ptr, ptr)
54
55declare i32 @f3(...)
56
57; Function Attrs: nounwind readnone
58declare i32 @llvm.eh.typeid.for(ptr) #0
59
60declare ptr @f4(ptr)
61
62declare void @f5()
63
64attributes #0 = { nounwind readnone }
65attributes #1 = { nounwind }
66attributes #2 = { noreturn }
67
68!0 = !{!1, !1, i64 0}
69!1 = !{!"int", !2}
70!2 = !{!"omnipotent char", !3}
71!3 = !{!"Simple C/C++ TBAA"}
72