Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc |
Tanya Lattner | e9789ef | 2004-11-06 23:32:43 +0000 | [diff] [blame] | 2 | ; RUN: lli %t.bc > /dev/null |
| 3 | |
Chris Lattner | ae1c1ff | 2003-08-23 23:38:59 +0000 | [diff] [blame] | 4 | ; This testcase exposes a bug in the local register allocator where it runs out |
| 5 | ; of registers (due to too many overlapping live ranges), but then attempts to |
| 6 | ; use the ESP register (which is not allocatable) to hold a value. |
| 7 | |
| 8 | int %main(uint %A) { |
| 9 | %Ap2 = alloca uint, uint %A ; ESP gets used again... |
| 10 | %B = add uint %A, 1 ; Produce lots of overlapping live ranges |
| 11 | %C = add uint %A, 2 |
| 12 | %D = add uint %A, 3 |
| 13 | %E = add uint %A, 4 |
| 14 | %F = add uint %A, 5 |
| 15 | %G = add uint %A, 6 |
| 16 | %H = add uint %A, 7 |
| 17 | %I = add uint %A, 8 |
| 18 | %J = add uint %A, 9 |
| 19 | %K = add uint %A, 10 |
| 20 | |
| 21 | store uint %A, uint *%Ap2 ; Uses of all of the values |
| 22 | store uint %B, uint *%Ap2 |
| 23 | store uint %C, uint *%Ap2 |
| 24 | store uint %D, uint *%Ap2 |
| 25 | store uint %E, uint *%Ap2 |
| 26 | store uint %F, uint *%Ap2 |
| 27 | store uint %G, uint *%Ap2 |
| 28 | store uint %H, uint *%Ap2 |
| 29 | store uint %I, uint *%Ap2 |
| 30 | store uint %J, uint *%Ap2 |
| 31 | store uint %K, uint *%Ap2 |
| 32 | ret int 0 |
| 33 | } |