1; RUN: llc -march=bpfel -filetype=obj -o - %s | llvm-objdump -d - | FileCheck %s
2
3; Source Code:
4; int gbl;
5; int test(int a, int b) {
6;   if (a == 2) {
7;     gbl = gbl * gbl * 2;
8;     goto out;
9;   }
10;   if (a != b) {
11;     gbl = gbl * 4;
12;   }
13; out:
14;   return gbl;
15; }
16
17@gbl = common local_unnamed_addr global i32 0, align 4
18
19define i32 @test(i32, i32) local_unnamed_addr #0 {
20  %3 = icmp eq i32 %0, 2
21  br i1 %3, label %4, label %8
22
23; <label>:4:                                      ; preds = %2
24  %5 = load i32, i32* @gbl, align 4
25  %6 = shl i32 %5, 1
26  %7 = mul i32 %6, %5
27  br label %13
28; CHECK: r1 <<= 32
29; CHECK: r1 >>= 32
30; CHECK: if r1 != 2 goto +6 <LBB0_2>
31
32; <label>:8:                                      ; preds = %2
33  %9 = icmp eq i32 %0, %1
34  %10 = load i32, i32* @gbl, align 4
35  br i1 %9, label %15, label %11
36
37; CHECK: r1 = 0 ll
38; CHECK: r0 = *(u32 *)(r1 + 0)
39; CHECK: r0 *= r0
40; CHECK: r0 <<= 1
41; CHECK: goto +7 <LBB0_4>
42
43; <label>:11:                                     ; preds = %8
44  %12 = shl nsw i32 %10, 2
45  br label %13
46
47; CHECK-LABEL: <LBB0_2>:
48; CHECK: r3 = 0 ll
49; CHECK: r0 = *(u32 *)(r3 + 0)
50; CHECK: r2 <<= 32
51; CHECK: r2 >>= 32
52; CHECK: if r1 == r2 goto +4 <LBB0_5>
53; CHECK: r0 <<= 2
54
55; <label>:13:                                     ; preds = %4, %11
56  %14 = phi i32 [ %12, %11 ], [ %7, %4 ]
57  store i32 %14, i32* @gbl, align 4
58  br label %15
59; CHECK-LABEL: <LBB0_4>:
60; CHECK: r1 = 0 ll
61; CHECK: *(u32 *)(r1 + 0) = r0
62
63; <label>:15:                                     ; preds = %8, %13
64  %16 = phi i32 [ %14, %13 ], [ %10, %8 ]
65  ret i32 %16
66; CHECK-LABEL: <LBB0_5>:
67; CHECK: exit
68}
69attributes #0 = { norecurse nounwind }
70