Chris Lattner | a99fb66 | 2002-10-09 20:37:13 +0000 | [diff] [blame] | 1 | ; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved |
| 2 | ; correctly. This doesn't have constantexprs |
| 3 | ; |
Misha Brukman | e78760e | 2003-09-16 15:29:54 +0000 | [diff] [blame] | 4 | ; RUN: llvm-as < %s | opt -funcresolve | llvm-dis | not grep external |
Chris Lattner | a99fb66 | 2002-10-09 20:37:13 +0000 | [diff] [blame] | 5 | ; |
| 6 | |
Chris Lattner | 2ff9343 | 2003-04-19 00:17:11 +0000 | [diff] [blame] | 7 | %X = external global [0 x int] |
Chris Lattner | a99fb66 | 2002-10-09 20:37:13 +0000 | [diff] [blame] | 8 | %X = global [4 x int] [ int 1, int 2, int 3, int 4 ] |
| 9 | |
| 10 | implementation ; Functions: |
| 11 | |
| 12 | int %foo(int %x) { |
| 13 | bb1: ;[#uses=0] |
Chris Lattner | 2ff9343 | 2003-04-19 00:17:11 +0000 | [diff] [blame] | 14 | %G = getelementptr [0 x int]* %X, long 0, long 1 |
Chris Lattner | a99fb66 | 2002-10-09 20:37:13 +0000 | [diff] [blame] | 15 | store int 5, int* %G |
Chris Lattner | 2ff9343 | 2003-04-19 00:17:11 +0000 | [diff] [blame] | 16 | %F = getelementptr [0 x int]* %X, long 0, long 2 |
Chris Lattner | a99fb66 | 2002-10-09 20:37:13 +0000 | [diff] [blame] | 17 | %val = load int* %F |
| 18 | ret int %val |
| 19 | } |
| 20 | |