• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=hexagon < %s | FileCheck %s
2
3target triple = "hexagon"
4%type.0 = type { i32, i8**, i32, i32, i32 }
5
6; Check that CFI is before the packet with call+allocframe.
7; CHECK-LABEL: danny:
8; CHECK: cfi_def_cfa
9; CHECK: call throw
10; CHECK-NEXT: allocframe
11
12; Expect packet:
13; {
14;   call throw
15;   allocframe(#0)
16; }
17
18define i8* @danny(%type.0* %p0, i32 %p1) #0 {
19entry:
20  %t0 = getelementptr inbounds %type.0, %type.0* %p0, i32 0, i32 4
21  %t1 = load i32, i32* %t0, align 4
22  %th = icmp ugt i32 %t1, %p1
23  br i1 %th, label %if.end, label %if.then
24
25if.then:                                          ; preds = %entry
26  tail call void @throw(%type.0* nonnull %p0)
27  unreachable
28
29if.end:                                           ; preds = %entry
30  %t6 = getelementptr inbounds %type.0, %type.0* %p0, i32 0, i32 3
31  %t2 = load i32, i32* %t6, align 4
32  %t9 = add i32 %t2, %p1
33  %ta = lshr i32 %t9, 4
34  %tb = and i32 %t9, 15
35  %t7 = getelementptr inbounds %type.0, %type.0* %p0, i32 0, i32 2
36  %t3 = load i32, i32* %t7, align 4
37  %tc = icmp ult i32 %ta, %t3
38  %td = select i1 %tc, i32 0, i32 %t3
39  %te = sub i32 %ta, %td
40  %t8 = getelementptr inbounds %type.0, %type.0* %p0, i32 0, i32 1
41  %t4 = load i8**, i8*** %t8, align 4
42  %tf = getelementptr inbounds i8*, i8** %t4, i32 %te
43  %t5 = load i8*, i8** %tf, align 4
44  %tg = getelementptr inbounds i8, i8* %t5, i32 %tb
45  ret i8* %tg
46}
47
48; Check that CFI is after allocframe.
49; CHECK-LABEL: sammy:
50; CHECK: allocframe
51; CHECK: cfi_def_cfa
52
53define void @sammy(%type.0* %p0, i32 %p1) #0 {
54entry:
55  %t0 = icmp sgt i32 %p1, 0
56  br i1 %t0, label %if.then, label %if.else
57if.then:
58  call void @throw(%type.0* nonnull %p0)
59  br label %if.end
60if.else:
61  call void @nothrow() #2
62  br label %if.end
63if.end:
64  ret void
65}
66
67declare void @throw(%type.0*) #1
68declare void @nothrow() #2
69
70attributes #0 = { "target-cpu"="hexagonv55" }
71attributes #1 = { noreturn "target-cpu"="hexagonv55" }
72attributes #2 = { nounwind "target-cpu"="hexagonv55" }
73