1 ; RUN: llc < %s | FileCheck %s
2 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
3 target triple = "thumbv7-unknown-linux-gnueabihf"
5 %Target = type { ptr, ptr }
6 %List = type { i32, ptr }
8 ; The entry block should be the first block of the function.
18 define i1 @foo(ptr %ha, i32 %he) !prof !39 {
20 %TargetPtr = load ptr, ptr %ha, align 4
21 %cmp1 = icmp eq ptr %TargetPtr, null
22 br i1 %cmp1, label %return, label %for.body, !prof !50
25 %TargetPhi = phi ptr [ %NextPtr, %for.inc ], [ %TargetPtr, %entry ]
26 %ListAddr = getelementptr inbounds %Target, ptr %TargetPhi, i32 0, i32 1
27 %ListPtr = load ptr, ptr %ListAddr, align 4
28 %cmp2 = icmp eq ptr %ListPtr, null
29 br i1 %cmp2, label %for.inc, label %if.then, !prof !59
32 %len = load i32, ptr %ListPtr, align 4
33 %ptr = getelementptr inbounds %List, ptr %ListPtr, i32 0, i32 1
34 %ptr2 = load ptr, ptr %ptr, align 4
38 %i = phi i32 [ %len, %if.then ], [ %index, %for.body.i ]
39 %index = add nsw i32 %i, -1
40 %cmp3 = icmp sgt i32 %i, 0
41 br i1 %cmp3, label %for.body.i, label %for.inc, !prof !75
44 %ptr3 = getelementptr inbounds i32, ptr %ptr2, i32 %index
45 %data = load i32, ptr %ptr3, align 4
46 %cmp4 = icmp eq i32 %data, %he
47 br i1 %cmp4, label %return, label %for.cond.i, !prof !79
50 %NextPtr = load ptr, ptr %TargetPhi, align 4
51 %cmp5 = icmp eq ptr %NextPtr, null
52 br i1 %cmp5, label %return, label %for.body, !prof !50
55 %retval = phi i1 [ false, %entry ], [ true, %for.body.i ], [ false, %for.inc ]
59 !39 = !{!"function_entry_count", i64 226}
60 !50 = !{!"branch_weights", i32 451, i32 1}
61 !59 = !{!"branch_weights", i32 1502, i32 1}
62 !75 = !{!"branch_weights", i32 301, i32 1}
63 !79 = !{!"branch_weights", i32 1, i32 301}