blob: b03e1569fde6be68834e735d86ff0d581a618491 [file] [log] [blame]
Dan Gohman1cf96c02015-12-09 16:23:59 +00001; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck %s
JF Bastien3428ed42015-10-17 00:25:38 +00002
Dan Gohmancf4748f2015-11-12 17:04:33 +00003; Check that unused vregs aren't assigned registers.
JF Bastien3428ed42015-10-17 00:25:38 +00004
5target datalayout = "e-p:32:32-i64:64-n32:64-S128"
6target triple = "wasm32-unknown-unknown"
7
8define void @foo(i32* nocapture %a, i32 %w, i32 %h) {
9; CHECK-LABEL: foo:
Dan Gohman1270b0a2015-11-25 17:33:15 +000010; CHECK-NEXT: .param i32, i32, i32{{$}}
Dan Gohmanfb3e0592015-11-25 19:36:19 +000011; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32, i32{{$}}
JF Bastien3428ed42015-10-17 00:25:38 +000012entry:
13 %cmp.19 = icmp sgt i32 %h, 0
14 br i1 %cmp.19, label %for.cond.1.preheader.lr.ph, label %for.end.7
15
16for.cond.1.preheader.lr.ph:
17 %cmp2.17 = icmp sgt i32 %w, 0
18 br label %for.cond.1.preheader
19
20for.cond.1.preheader:
21 %y.020 = phi i32 [ 0, %for.cond.1.preheader.lr.ph ], [ %inc6, %for.inc.5 ]
22 br i1 %cmp2.17, label %for.body.3.lr.ph, label %for.inc.5
23
24for.body.3.lr.ph:
25 %mul4 = mul nsw i32 %y.020, %w
26 br label %for.body.3
27
28for.body.3:
29 %x.018 = phi i32 [ 0, %for.body.3.lr.ph ], [ %inc, %for.body.3 ]
30 %mul = mul nsw i32 %x.018, %y.020
31 %add = add nsw i32 %x.018, %mul4
32 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %add
33 store i32 %mul, i32* %arrayidx, align 4
34 %inc = add nuw nsw i32 %x.018, 1
35 %exitcond = icmp eq i32 %inc, %w
36 br i1 %exitcond, label %for.inc.5.loopexit, label %for.body.3
37
38for.inc.5.loopexit:
39 br label %for.inc.5
40
41for.inc.5:
42 %inc6 = add nuw nsw i32 %y.020, 1
43 %exitcond22 = icmp eq i32 %inc6, %h
44 br i1 %exitcond22, label %for.end.7.loopexit, label %for.cond.1.preheader
45
46for.end.7.loopexit:
47 br label %for.end.7
48
49for.end.7:
50 ret void
51}