blob: fc875f6ef7a34301c18faea68fcdce51e7b90461 [file] [log] [blame]
Tom Stellard49f8bfd2015-01-06 18:00:21 +00001; RUN: llc -march=amdgcn -mcpu=SI -mattr=-promote-alloca -verify-machineinstrs < %s
Marek Olsak75170772015-01-27 17:27:15 +00002; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-promote-alloca -verify-machineinstrs < %s
Tom Stellard3457a842014-10-09 19:06:00 +00003
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:
9define void @copy_to_reg_frameindex(i32 addrspace(1)* %out, i32 %a, i32 %b, i32 %c) {
10entry:
11 %alloca = alloca [16 x i32]
12 br label %loop
13
14loop:
15 %inc = phi i32 [0, %entry], [%inc.i, %loop]
David Blaikie79e6c742015-02-27 19:29:02 +000016 %ptr = getelementptr [16 x i32], [16 x i32]* %alloca, i32 0, i32 %inc
Tom Stellard3457a842014-10-09 19:06:00 +000017 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
22done:
David Blaikie79e6c742015-02-27 19:29:02 +000023 %tmp0 = getelementptr [16 x i32], [16 x i32]* %alloca, i32 0, i32 0
David Blaikiea79ac142015-02-27 21:17:42 +000024 %tmp1 = load i32, i32* %tmp0
Tom Stellard3457a842014-10-09 19:06:00 +000025 store i32 %tmp1, i32 addrspace(1)* %out
26 ret void
27}