• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -mtriple i686-win32 -rewrite-symbols -rewrite-map-file %p/rewrite.map \
2; RUN:   %s -o - | llvm-dis | FileCheck %s
3; RUN: opt -mtriple i686-win32 -passes='rewrite-symbols' -rewrite-map-file %p/rewrite.map \
4; RUN:   %s -o - | llvm-dis | FileCheck %s
5
6declare void @source_function()
7@source_variable = external global i32
8declare void @source_function_pattern_function()
9declare void @source_function_pattern_multiple_function_matches()
10@source_variable_pattern_variable = external global i32
11@source_variable_pattern_multiple_variable_matches = external global i32
12declare void @"\01naked_source_function"()
13declare void @"\01__imp_missing_global_leader_prefix"()
14
15declare i32 @first_callee()
16declare i32 @second_callee()
17define i32 @caller() {
18  %rhs = call i32 @first_callee()
19  %lhs = call i32 @second_callee()
20  %res = add i32 %rhs, %lhs
21  ret i32 %res
22}
23
24%struct.S = type { i8 }
25@_ZN1SC1Ev = alias void (%struct.S*), void (%struct.S*)* @_ZN1SC2Ev
26define void @_ZN1SC2Ev(%struct.S* %this) unnamed_addr align 2 {
27entry:
28  %this.addr = alloca %struct.S*, align 4
29  store %struct.S* %this, %struct.S** %this.addr, align 4
30  ret void
31}
32
33$source_comdat_function = comdat any
34define dllexport void @source_comdat_function() comdat($source_comdat_function) {
35entry:
36  ret void
37}
38
39$source_comdat_function_1 = comdat exactmatch
40define dllexport void @source_comdat_function_1() comdat($source_comdat_function_1) {
41entry:
42  ret void
43}
44
45$source_comdat_variable = comdat largest
46@source_comdat_variable = global i32 32, comdat($source_comdat_variable)
47
48$source_comdat_variable_1 = comdat noduplicates
49@source_comdat_variable_1 = global i32 64, comdat($source_comdat_variable_1)
50
51; CHECK: $target_comdat_function = comdat any
52; CHECK: $target_comdat_function_1 = comdat exactmatch
53; CHECK: $target_comdat_variable = comdat largest
54; CHECK: $target_comdat_variable_1 = comdat noduplicates
55
56; CHECK: @target_variable = external global i32
57; CHECK-NOT: @source_variable = external global i32
58; CHECK: @target_pattern_variable = external global i32
59; CHECK-NOT: @source_pattern_variable = external global i32
60; CHECK: @target_pattern_multiple_variable_matches = external global i32
61; CHECK-NOT: @source_pattern_multiple_variable_matches = external global i32
62; CHECK: @target_comdat_variable = global i32 32, comdat
63; CHECK-NOT: @source_comdat_variable = global i32 32, comdat
64; CHECK: @target_comdat_variable_1 = global i32 64, comdat
65; CHECK-NOT: @source_comdat_variable_1 = global i32 64, comdat
66
67; CHECK: declare void @target_function()
68; CHECK-NOT: declare void @source_function()
69; CHECK: declare void @target_pattern_function()
70; CHECK-NOT: declare void @source_function_pattern_function()
71; CHECK: declare void @target_pattern_multiple_function_matches()
72; CHECK-NOT: declare void @source_function_pattern_multiple_function_matches()
73; CHECK: declare void @naked_target_function()
74; CHECK-NOT: declare void @"\01naked_source_function"()
75; CHECK-NOT: declare void @"\01__imp__imported_function"()
76; CHECK: declare void @"\01__imp_missing_global_leader_prefix"()
77; CHECK-NOT: declare void @"\01__imp_DO_NOT_REWRITE"()
78
79; CHECK: declare i32 @renamed_callee()
80; CHECK-NOT: declare i32 @first_callee()
81; CHECK: declare i32 @second_callee()
82; CHECK: define i32 @caller() {
83; CHECK:   %rhs = call i32 @renamed_callee()
84; CHECK-NOT: %rhs = call i32 @first_callee()
85; CHECK:   %lhs = call i32 @second_callee()
86; CHECK:   %res = add i32 %rhs, %lhs
87; CHECK:   ret i32 %res
88; CHECK: }
89
90; CHECK: define dllexport void @target_comdat_function() comdat
91; CHECK-NOT: define dllexport void @source_comdat_function() comdat
92; CHECK: define dllexport void @target_comdat_function_1() comdat
93; CHECK-NOT: define dllexport void @source_comdat_function_1() comdat
94
95