aliases.ll 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. @llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @foo1 to i8*)], section "llvm.metadata"
  5. @bar = global i32 0
  6. @foo1 = alias i32* @bar
  7. @foo2 = alias i32* @bar
  8. @foo3 = alias i32* @foo2
  9. @foo4 = unnamed_addr alias i32* @foo2
  10. ; Make sure the verifier does not complain about references to a global
  11. ; declaration from an initializer.
  12. @decl = external global i32
  13. @ptr = global i32* @decl
  14. @ptr_a = alias i32** @ptr
  15. %FunTy = type i32()
  16. define i32 @foo_f() {
  17. ret i32 0
  18. }
  19. @bar_f = weak_odr alias %FunTy* @foo_f
  20. @bar_ff = alias i32()* @bar_f
  21. @bar_i = internal alias i32* @bar
  22. @A = alias bitcast (i32* @bar to i64*)
  23. define i32 @test() {
  24. entry:
  25. %tmp = load i32, i32* @foo1
  26. %tmp1 = load i32, i32* @foo2
  27. %tmp0 = load i32, i32* @bar_i
  28. %tmp2 = call i32 @foo_f()
  29. %tmp3 = add i32 %tmp, %tmp2
  30. %tmp4 = call %FunTy @bar_f()
  31. %tmp5 = add i32 %tmp3, %tmp4
  32. %tmp6 = add i32 %tmp1, %tmp5
  33. %tmp7 = add i32 %tmp6, %tmp0
  34. ret i32 %tmp7
  35. }