xref: /aosp_15_r20/external/llvm/test/CodeGen/WebAssembly/dead-vreg.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Check that unused vregs aren't assigned registers.
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
6*9880d681SAndroid Build Coastguard Workertarget triple = "wasm32-unknown-unknown"
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine void @foo(i32* nocapture %a, i32 %w, i32 %h) {
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo:
10*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .param i32, i32, i32{{$}}
11*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .local i32, i32, i32, i32, i32, i32{{$}}
12*9880d681SAndroid Build Coastguard Workerentry:
13*9880d681SAndroid Build Coastguard Worker  %cmp.19 = icmp sgt i32 %h, 0
14*9880d681SAndroid Build Coastguard Worker  br i1 %cmp.19, label %for.cond.1.preheader.lr.ph, label %for.end.7
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerfor.cond.1.preheader.lr.ph:
17*9880d681SAndroid Build Coastguard Worker  %cmp2.17 = icmp sgt i32 %w, 0
18*9880d681SAndroid Build Coastguard Worker  br label %for.cond.1.preheader
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerfor.cond.1.preheader:
21*9880d681SAndroid Build Coastguard Worker  %y.020 = phi i32 [ 0, %for.cond.1.preheader.lr.ph ], [ %inc6, %for.inc.5 ]
22*9880d681SAndroid Build Coastguard Worker  br i1 %cmp2.17, label %for.body.3.lr.ph, label %for.inc.5
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerfor.body.3.lr.ph:
25*9880d681SAndroid Build Coastguard Worker  %mul4 = mul nsw i32 %y.020, %w
26*9880d681SAndroid Build Coastguard Worker  br label %for.body.3
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerfor.body.3:
29*9880d681SAndroid Build Coastguard Worker  %x.018 = phi i32 [ 0, %for.body.3.lr.ph ], [ %inc, %for.body.3 ]
30*9880d681SAndroid Build Coastguard Worker  %mul = mul nsw i32 %x.018, %y.020
31*9880d681SAndroid Build Coastguard Worker  %add = add nsw i32 %x.018, %mul4
32*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds i32, i32* %a, i32 %add
33*9880d681SAndroid Build Coastguard Worker  store i32 %mul, i32* %arrayidx, align 4
34*9880d681SAndroid Build Coastguard Worker  %inc = add nuw nsw i32 %x.018, 1
35*9880d681SAndroid Build Coastguard Worker  %exitcond = icmp eq i32 %inc, %w
36*9880d681SAndroid Build Coastguard Worker  br i1 %exitcond, label %for.inc.5.loopexit, label %for.body.3
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerfor.inc.5.loopexit:
39*9880d681SAndroid Build Coastguard Worker  br label %for.inc.5
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workerfor.inc.5:
42*9880d681SAndroid Build Coastguard Worker  %inc6 = add nuw nsw i32 %y.020, 1
43*9880d681SAndroid Build Coastguard Worker  %exitcond22 = icmp eq i32 %inc6, %h
44*9880d681SAndroid Build Coastguard Worker  br i1 %exitcond22, label %for.end.7.loopexit, label %for.cond.1.preheader
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerfor.end.7.loopexit:
47*9880d681SAndroid Build Coastguard Worker  br label %for.end.7
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Workerfor.end.7:
50*9880d681SAndroid Build Coastguard Worker  ret void
51*9880d681SAndroid Build Coastguard Worker}
52