blob: 181a09d5924b9cc5094d5767a8579df5e52b3093 [file] [log] [blame]
JF Bastien3428ed42015-10-17 00:25:38 +00001; RUN: llc < %s -asm-verbose=false | FileCheck %s
2
Hans Wennborg7384a2d2015-11-12 14:37:56 +00003; Check that unused vregs don't prevent locals from being numbered wrong.
4;
5; The test currently checks that the dead virtual registers still appear as
6; locals, which isn't what we want long term. Removing them from the list of
7; locals will require remapping the local numbers, and checking that the
8; get_/set_local have the right numbers.
JF Bastien3428ed42015-10-17 00:25:38 +00009
10target datalayout = "e-p:32:32-i64:64-n32:64-S128"
11target triple = "wasm32-unknown-unknown"
12
13define void @foo(i32* nocapture %a, i32 %w, i32 %h) {
14; CHECK-LABEL: foo:
15; CHECK-NEXT: .param i32
16; CHECK-NEXT: .param i32
17; CHECK-NEXT: .param i32
Hans Wennborg7384a2d2015-11-12 14:37:56 +000018; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32{{$}}
JF Bastien3428ed42015-10-17 00:25:38 +000019entry:
20 %cmp.19 = icmp sgt i32 %h, 0
21 br i1 %cmp.19, label %for.cond.1.preheader.lr.ph, label %for.end.7
22
23for.cond.1.preheader.lr.ph:
24 %cmp2.17 = icmp sgt i32 %w, 0
25 br label %for.cond.1.preheader
26
27for.cond.1.preheader:
28 %y.020 = phi i32 [ 0, %for.cond.1.preheader.lr.ph ], [ %inc6, %for.inc.5 ]
29 br i1 %cmp2.17, label %for.body.3.lr.ph, label %for.inc.5
30
31for.body.3.lr.ph:
32 %mul4 = mul nsw i32 %y.020, %w
33 br label %for.body.3
34
35for.body.3:
36 %x.018 = phi i32 [ 0, %for.body.3.lr.ph ], [ %inc, %for.body.3 ]
37 %mul = mul nsw i32 %x.018, %y.020
38 %add = add nsw i32 %x.018, %mul4
39 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %add
40 store i32 %mul, i32* %arrayidx, align 4
41 %inc = add nuw nsw i32 %x.018, 1
42 %exitcond = icmp eq i32 %inc, %w
43 br i1 %exitcond, label %for.inc.5.loopexit, label %for.body.3
44
45for.inc.5.loopexit:
46 br label %for.inc.5
47
48for.inc.5:
49 %inc6 = add nuw nsw i32 %y.020, 1
50 %exitcond22 = icmp eq i32 %inc6, %h
51 br i1 %exitcond22, label %for.end.7.loopexit, label %for.cond.1.preheader
52
53for.end.7.loopexit:
54 br label %for.end.7
55
56for.end.7:
57 ret void
58}