testlink.ll 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ; RUN: llvm-link %s %S/Inputs/testlink.ll -S | FileCheck %s
  2. ; CHECK: %Ty2 = type { %Ty1* }
  3. ; CHECK: %Ty1 = type { %Ty2* }
  4. %Ty1 = type opaque
  5. %Ty2 = type { %Ty1* }
  6. ; CHECK: %intlist = type { %intlist*, i32 }
  7. %intlist = type { %intlist*, i32 }
  8. ; The uses of intlist in the other file should be remapped.
  9. ; CHECK-NOT: {{%intlist.[0-9]}}
  10. ; CHECK: %VecSize = type { <5 x i32> }
  11. ; CHECK: %VecSize.{{[0-9]}} = type { <10 x i32> }
  12. %VecSize = type { <5 x i32> }
  13. %Struct1 = type opaque
  14. @S1GV = external global %Struct1*
  15. @GVTy1 = external global %Ty1*
  16. @GVTy2 = global %Ty2* null
  17. ; This should stay the same
  18. ; CHECK-DAG: @MyIntList = global %intlist { %intlist* null, i32 17 }
  19. @MyIntList = global %intlist { %intlist* null, i32 17 }
  20. ; Nothing to link here.
  21. ; CHECK-DAG: @0 = external global i32
  22. @0 = external global i32
  23. ; CHECK-DAG: @Inte = global i32 1
  24. @Inte = global i32 1
  25. ; Intern1 is intern in both files, rename testlink2's.
  26. ; CHECK-DAG: @Intern1 = internal constant i32 42
  27. @Intern1 = internal constant i32 42
  28. @UseIntern1 = global i32* @Intern1
  29. ; This should get renamed since there is a definition that is non-internal in
  30. ; the other module.
  31. ; CHECK-DAG: @Intern2{{[0-9]+}} = internal constant i32 792
  32. @Intern2 = internal constant i32 792
  33. @UseIntern2 = global i32* @Intern2
  34. ; CHECK-DAG: @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
  35. @MyVarPtr = linkonce global { i32* } { i32* @MyVar }
  36. @UseMyVarPtr = global { i32* }* @MyVarPtr
  37. ; CHECK-DAG: @MyVar = global i32 4
  38. @MyVar = external global i32
  39. ; Take value from other module.
  40. ; CHECK-DAG: AConst = constant i32 1234
  41. @AConst = linkonce constant i32 123
  42. ; Renamed version of Intern1.
  43. ; CHECK-DAG: @Intern1.{{[0-9]+}} = internal constant i32 52
  44. ; Globals linked from testlink2.
  45. ; CHECK-DAG: @Intern2 = constant i32 12345
  46. ; CHECK-DAG: @MyIntListPtr = constant
  47. ; CHECK-DAG: @1 = constant i32 412
  48. declare i32 @foo(i32)
  49. declare void @print(i32)
  50. define void @main() {
  51. %v1 = load i32, i32* @MyVar
  52. call void @print(i32 %v1)
  53. %idx = getelementptr %intlist, %intlist* @MyIntList, i64 0, i32 1
  54. %v2 = load i32, i32* %idx
  55. call void @print(i32 %v2)
  56. %1 = call i32 @foo(i32 5)
  57. %v3 = load i32, i32* @MyVar
  58. call void @print(i32 %v3)
  59. %v4 = load i32, i32* %idx
  60. call void @print(i32 %v4)
  61. ret void
  62. }
  63. define internal void @testintern() {
  64. ret void
  65. }
  66. define internal void @Testintern() {
  67. ret void
  68. }
  69. define void @testIntern() {
  70. ret void
  71. }
  72. declare void @VecSizeCrash(%VecSize)