• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-block-placement | FileCheck %s
2
3; Test irreducible CFG handling.
4
5target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
6target triple = "wasm32-unknown-unknown"
7
8; A simple loop with two entries.
9
10; CHECK-LABEL: test0:
11; CHECK: f64.load
12; CHECK: i32.const $[[REG:[^,]+]]=, 0{{$}}
13; CHECK: br_table  $[[REG]],
14define void @test0(double* %arg, i32 %arg1, i32 %arg2, i32 %arg3) {
15bb:
16  %tmp = icmp eq i32 %arg2, 0
17  br i1 %tmp, label %bb6, label %bb3
18
19bb3:
20  %tmp4 = getelementptr double, double* %arg, i32 %arg3
21  %tmp5 = load double, double* %tmp4, align 4
22  br label %bb13
23
24bb6:
25  %tmp7 = phi i32 [ %tmp18, %bb13 ], [ 0, %bb ]
26  %tmp8 = icmp slt i32 %tmp7, %arg1
27  br i1 %tmp8, label %bb9, label %bb19
28
29bb9:
30  %tmp10 = getelementptr double, double* %arg, i32 %tmp7
31  %tmp11 = load double, double* %tmp10, align 4
32  %tmp12 = fmul double %tmp11, 2.300000e+00
33  store double %tmp12, double* %tmp10, align 4
34  br label %bb13
35
36bb13:
37  %tmp14 = phi double [ %tmp5, %bb3 ], [ %tmp12, %bb9 ]
38  %tmp15 = phi i32 [ undef, %bb3 ], [ %tmp7, %bb9 ]
39  %tmp16 = getelementptr double, double* %arg, i32 %tmp15
40  %tmp17 = fadd double %tmp14, 1.300000e+00
41  store double %tmp17, double* %tmp16, align 4
42  %tmp18 = add nsw i32 %tmp15, 1
43  br label %bb6
44
45bb19:
46  ret void
47}
48
49; A simple loop with two entries and an inner natural loop.
50
51; CHECK-LABEL: test1:
52; CHECK: f64.load
53; CHECK: i32.const $[[REG:[^,]+]]=, 0{{$}}
54; CHECK: br_table  $[[REG]],
55define void @test1(double* %arg, i32 %arg1, i32 %arg2, i32 %arg3) {
56bb:
57  %tmp = icmp eq i32 %arg2, 0
58  br i1 %tmp, label %bb6, label %bb3
59
60bb3:
61  %tmp4 = getelementptr double, double* %arg, i32 %arg3
62  %tmp5 = load double, double* %tmp4, align 4
63  br label %bb13
64
65bb6:
66  %tmp7 = phi i32 [ %tmp18, %bb13 ], [ 0, %bb ]
67  %tmp8 = icmp slt i32 %tmp7, %arg1
68  br i1 %tmp8, label %bb9, label %bb19
69
70bb9:
71  %tmp10 = getelementptr double, double* %arg, i32 %tmp7
72  %tmp11 = load double, double* %tmp10, align 4
73  %tmp12 = fmul double %tmp11, 2.300000e+00
74  store double %tmp12, double* %tmp10, align 4
75  br label %bb10
76
77bb10:
78  %p = phi i32 [ 0, %bb9 ], [ %pn, %bb10 ]
79  %pn = add i32 %p, 1
80  %c = icmp slt i32 %pn, 256
81  br i1 %c, label %bb10, label %bb13
82
83bb13:
84  %tmp14 = phi double [ %tmp5, %bb3 ], [ %tmp12, %bb10 ]
85  %tmp15 = phi i32 [ undef, %bb3 ], [ %tmp7, %bb10 ]
86  %tmp16 = getelementptr double, double* %arg, i32 %tmp15
87  %tmp17 = fadd double %tmp14, 1.300000e+00
88  store double %tmp17, double* %tmp16, align 4
89  %tmp18 = add nsw i32 %tmp15, 1
90  br label %bb6
91
92bb19:
93  ret void
94}
95