blob: 4a414356710200a041f6797019020eda71c7f871 [file] [log] [blame]
Tom Stellard49f8bfd2015-01-06 18:00:21 +00001; RUN: llc -march=amdgcn -mcpu=SI -mattr=-promote-alloca -verify-machineinstrs < %s
Tom Stellard3457a842014-10-09 19:06:00 +00002
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:
8define void @copy_to_reg_frameindex(i32 addrspace(1)* %out, i32 %a, i32 %b, i32 %c) {
9entry:
10 %alloca = alloca [16 x i32]
11 br label %loop
12
13loop:
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
21done:
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}