1; RUN: llc -O1 -mtriple=arm64-apple-ios7.0.0 -enable-andcmp-sinking=true < %s | FileCheck %s
2; ModuleID = 'and-cbz-extr-mr.bc'
3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32:64-S128"
4
5define zeroext i1 @foo(i1 %IsEditable, i1 %isTextField, i8* %str1, i8* %str2, i8* %str3, i8* %str4, i8* %str5, i8* %str6, i8* %str7, i8* %str8, i8* %str9, i8* %str10, i8* %str11, i8* %str12, i8* %str13, i32 %int1, i8* %str14) unnamed_addr #0 align 2 {
6; CHECK: _foo:
7entry:
8  %tobool = icmp eq i8* %str14, null
9  br i1 %tobool, label %return, label %if.end
10
11; CHECK: %if.end
12; CHECK: tbz
13if.end:                                           ; preds = %entry
14  %and.i.i.i = and i32 %int1, 4
15  %tobool.i.i.i = icmp eq i32 %and.i.i.i, 0
16  br i1 %tobool.i.i.i, label %if.end12, label %land.rhs.i, !prof !1
17
18land.rhs.i:                                       ; preds = %if.end
19  %cmp.i.i.i = icmp eq i8* %str12, %str13
20  br i1 %cmp.i.i.i, label %if.then3, label %lor.rhs.i.i.i
21
22lor.rhs.i.i.i:                                    ; preds = %land.rhs.i
23  %cmp.i13.i.i.i = icmp eq i8* %str10, %str11
24  br i1 %cmp.i13.i.i.i, label %_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit, label %if.end5
25
26_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit: ; preds = %lor.rhs.i.i.i
27  %cmp.i.i.i.i = icmp eq i8* %str8, %str9
28  br i1 %cmp.i.i.i.i, label %if.then3, label %if.end5
29
30if.then3:                                         ; preds = %_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit, %land.rhs.i
31  %tmp11 = load i8, i8* %str14, align 8
32  %tmp12 = and i8 %tmp11, 2
33  %tmp13 = icmp ne i8 %tmp12, 0
34  br label %return
35
36if.end5:                                          ; preds = %_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit, %lor.rhs.i.i.i
37; CHECK: %if.end5
38; CHECK: tbz
39  br i1 %tobool.i.i.i, label %if.end12, label %land.rhs.i19, !prof !1
40
41land.rhs.i19:                                     ; preds = %if.end5
42  %cmp.i.i.i18 = icmp eq i8* %str6, %str7
43  br i1 %cmp.i.i.i18, label %if.then7, label %lor.rhs.i.i.i23
44
45lor.rhs.i.i.i23:                                  ; preds = %land.rhs.i19
46  %cmp.i13.i.i.i22 = icmp eq i8* %str3, %str4
47  br i1 %cmp.i13.i.i.i22, label %_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit28, label %if.end12
48
49_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit28: ; preds = %lor.rhs.i.i.i23
50  %cmp.i.i.i.i26 = icmp eq i8* %str1, %str2
51  br i1 %cmp.i.i.i.i26, label %if.then7, label %if.end12
52
53if.then7:                                         ; preds = %_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit28, %land.rhs.i19
54  br i1 %isTextField, label %if.then9, label %if.end12
55
56if.then9:                                         ; preds = %if.then7
57  %tmp23 = load i8, i8* %str5, align 8
58  %tmp24 = and i8 %tmp23, 2
59  %tmp25 = icmp ne i8 %tmp24, 0
60  br label %return
61
62if.end12:                                         ; preds = %if.then7, %_ZNK7WebCore4Node10hasTagNameERKNS_13QualifiedNameE.exit28, %lor.rhs.i.i.i23, %if.end5, %if.end
63  %lnot = xor i1 %IsEditable, true
64  br label %return
65
66return:                                           ; preds = %if.end12, %if.then9, %if.then3, %entry
67  %retval.0 = phi i1 [ %tmp13, %if.then3 ], [ %tmp25, %if.then9 ], [ %lnot, %if.end12 ], [ true, %entry ]
68  ret i1 %retval.0
69}
70
71attributes #0 = { nounwind ssp }
72!1 = !{!"branch_weights", i32 3, i32 5}
73