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
6 declare void @source_function()
7 @source_variable = external global i32
8 declare void @source_function_pattern_function()
9 declare 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
12 declare void @"\01naked_source_function"()
13 declare void @"\01__imp_missing_global_leader_prefix"()
15 declare i32 @first_callee()
16 declare i32 @second_callee()
17 define i32 @caller() {
18 %rhs = call i32 @first_callee()
19 %lhs = call i32 @second_callee()
20 %res = add i32 %rhs, %lhs
24 %struct.S = type { i8 }
25 @_ZN1SC1Ev = alias void (%struct.S*), void (%struct.S*)* @_ZN1SC2Ev
26 define void @_ZN1SC2Ev(%struct.S* %this) unnamed_addr align 2 {
28 %this.addr = alloca %struct.S*, align 4
29 store %struct.S* %this, %struct.S** %this.addr, align 4
33 $source_comdat_function = comdat any
34 define dllexport void @source_comdat_function() comdat($source_comdat_function) {
39 $source_comdat_function_1 = comdat exactmatch
40 define dllexport void @source_comdat_function_1() comdat($source_comdat_function_1) {
45 $source_comdat_variable = comdat largest
46 @source_comdat_variable = global i32 32, comdat($source_comdat_variable)
48 $source_comdat_variable_1 = comdat noduplicates
49 @source_comdat_variable_1 = global i32 64, comdat($source_comdat_variable_1)
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
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
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"()
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
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