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