constpointer.ll 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. ; RUN: llvm-as < %s | llvm-dis > %t1.ll
  2. ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
  3. ; RUN: diff %t1.ll %t2.ll
  4. ; This testcase is primarily used for testing that global values can be used as
  5. ; constant pointer initializers. This is tricky because they can be forward
  6. ; declared and involves an icky bytecode encoding. There is no meaningful
  7. ; optimization that can be performed on this file, it is just here to test
  8. ; assembly and disassembly.
  9. ;
  10. @t3 = global i32* @t1 ;; Forward reference
  11. @t1 = global i32 4
  12. @t4 = global i32** @t3 ;; reference to reference
  13. @t2 = global i32* @t1
  14. global float * @2 ;; Forward numeric reference
  15. global float * @2 ;; Duplicate forward numeric reference
  16. global float 0.0
  17. global float * @2 ;; Numeric reference
  18. @fptr = global void() * @f ;; Forward ref method defn
  19. declare void @f() ;; External method
  20. @sptr1 = global [11x i8]* @somestr ;; Forward ref to a constant
  21. @somestr = constant [11x i8] c"hello world"
  22. @sptr2 = global [11x i8]* @somestr