1; RUN: llc < %s | FileCheck %s
2; Check for allocframe in a non-entry block LBB0_n.
3; CHECK: LBB0_{{[0-9]+}}:
4; CHECK:   allocframe
5; Deallocframe may be in a different block, but must follow.
6; CHECK: deallocframe
7
8target datalayout = "e-m:e-p:32:32-i1:32-i64:64-a:0-v32:32-n16:32"
9target triple = "hexagon"
10
11; Function Attrs: nounwind
12define i32 @foo(i32 %n, i32* %p) #0 {
13entry:
14  %cmp = icmp eq i32* %p, null
15  br i1 %cmp, label %if.end, label %if.then
16
17if.then:                                          ; preds = %entry
18  %0 = load i32, i32* %p, align 4
19  %inc = add nsw i32 %0, 1
20  store i32 %inc, i32* %p, align 4
21  br label %return
22
23if.end:                                           ; preds = %entry
24  %call = tail call i32 bitcast (i32 (...)* @bar to i32 (i32)*)(i32 %n) #0
25  %add = add nsw i32 %call, 1
26  br label %return
27
28return:                                           ; preds = %if.end, %if.then
29  %retval.0 = phi i32 [ %0, %if.then ], [ %add, %if.end ]
30  ret i32 %retval.0
31}
32
33declare i32 @bar(...) #0
34
35attributes #0 = { nounwind }
36
37