R600/SI: Legalize CopyToReg during instruction selection
[oota-llvm.git] / test / CodeGen / R600 / copy-to-reg.ll
1 ; RUN: llc -march=r600 -mcpu=SI -mattr=-promote-alloca -verify-machineinstrs < %s
2
3 ; Test that CopyToReg instructions don't have non-register operands prior
4 ; to being emitted.
5
6 ; Make sure this doesn't crash
7 ; CHECK-LABEL: {{^}}copy_to_reg_frameindex:
8 define void @copy_to_reg_frameindex(i32 addrspace(1)* %out, i32 %a, i32 %b, i32 %c) {
9 entry:
10   %alloca = alloca [16 x i32]
11   br label %loop
12
13 loop:
14   %inc = phi i32 [0, %entry], [%inc.i, %loop]
15   %ptr = getelementptr [16 x i32]* %alloca, i32 0, i32 %inc
16   store i32 %inc, i32* %ptr
17   %inc.i = add i32 %inc, 1
18   %cnd = icmp uge i32 %inc.i, 16
19   br i1 %cnd, label %done, label %loop
20
21 done:
22   %tmp0 = getelementptr [16 x i32]* %alloca, i32 0, i32 0
23   %tmp1 = load i32* %tmp0
24   store i32 %tmp1, i32 addrspace(1)* %out
25   ret void
26 }