Tanya Lattner | 9bc243b | 2008-03-01 07:38:40 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llvm-dis > %t1.ll |
Tanya Lattner | 3f7706b | 2004-11-07 06:08:43 +0000 | [diff] [blame] | 2 | ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll |
| 3 | ; RUN: diff %t1.ll %t2.ll |
| 4 | |
Chris Lattner | 5bc20c7 | 2001-10-13 07:16:11 +0000 | [diff] [blame] | 5 | ; This testcase is primarily used for testing that global values can be used as |
| 6 | ; constant pointer initializers. This is tricky because they can be forward |
| 7 | ; declared and involves an icky bytecode encoding. There is no meaningful |
| 8 | ; optimization that can be performed on this file, it is just here to test |
| 9 | ; assembly and disassembly. |
| 10 | ; |
| 11 | |
| 12 | |
Tanya Lattner | 9bc243b | 2008-03-01 07:38:40 +0000 | [diff] [blame] | 13 | @t3 = global i32* @t1 ;; Forward reference |
| 14 | @t1 = global i32 4 |
| 15 | @t4 = global i32** @t3 ;; reference to reference |
Vikram S. Adve | b26ff62 | 2002-07-14 23:18:33 +0000 | [diff] [blame] | 16 | |
Tanya Lattner | 9bc243b | 2008-03-01 07:38:40 +0000 | [diff] [blame] | 17 | @t2 = global i32* @t1 |
Chris Lattner | 5bc20c7 | 2001-10-13 07:16:11 +0000 | [diff] [blame] | 18 | |
Tanya Lattner | 9bc243b | 2008-03-01 07:38:40 +0000 | [diff] [blame] | 19 | global float * @2 ;; Forward numeric reference |
| 20 | global float * @2 ;; Duplicate forward numeric reference |
Chris Lattner | 5bc20c7 | 2001-10-13 07:16:11 +0000 | [diff] [blame] | 21 | global float 0.0 |
Tanya Lattner | 9bc243b | 2008-03-01 07:38:40 +0000 | [diff] [blame] | 22 | global float * @2 ;; Numeric reference |
Chris Lattner | 5bc20c7 | 2001-10-13 07:16:11 +0000 | [diff] [blame] | 23 | |
| 24 | |
Tanya Lattner | 9bc243b | 2008-03-01 07:38:40 +0000 | [diff] [blame] | 25 | @fptr = global void() * @f ;; Forward ref method defn |
| 26 | declare void @f() ;; External method |
Chris Lattner | 5bc20c7 | 2001-10-13 07:16:11 +0000 | [diff] [blame] | 27 | |
Tanya Lattner | 9bc243b | 2008-03-01 07:38:40 +0000 | [diff] [blame] | 28 | @sptr1 = global [11x i8]* @somestr ;; Forward ref to a constant |
| 29 | @somestr = constant [11x i8] c"hello world" |
| 30 | @sptr2 = global [11x i8]* @somestr |
Chris Lattner | 5bc20c7 | 2001-10-13 07:16:11 +0000 | [diff] [blame] | 31 | |