1 ; RUN: opt -mtriple i686-win32 -passes='rewrite-symbols' -rewrite-map-file %p/rewrite.map \
2 ; RUN: %s -o - | llvm-dis | FileCheck %s
4 declare void @source_function()
5 @source_variable = external global i32
6 declare void @source_function_pattern_function()
7 declare void @source_function_pattern_multiple_function_matches()
8 @source_variable_pattern_variable = external global i32
9 @source_variable_pattern_multiple_variable_matches = external global i32
10 declare void @"\01naked_source_function"()
11 declare void @"\01__imp_missing_global_leader_prefix"()
13 declare i32 @first_callee()
14 declare i32 @second_callee()
15 define i32 @caller() {
16 %rhs = call i32 @first_callee()
17 %lhs = call i32 @second_callee()
18 %res = add i32 %rhs, %lhs
22 %struct.S = type { i8 }
23 @_ZN1SC1Ev = alias void (ptr), ptr @_ZN1SC2Ev
24 define void @_ZN1SC2Ev(ptr %this) unnamed_addr align 2 {
26 %this.addr = alloca ptr, align 4
27 store ptr %this, ptr %this.addr, align 4
31 $source_comdat_function = comdat any
32 define dllexport void @source_comdat_function() comdat($source_comdat_function) {
37 $source_comdat_function_1 = comdat exactmatch
38 define dllexport void @source_comdat_function_1() comdat($source_comdat_function_1) {
43 $source_comdat_variable = comdat largest
44 @source_comdat_variable = global i32 32, comdat($source_comdat_variable)
46 $source_comdat_variable_1 = comdat nodeduplicate
47 @source_comdat_variable_1 = global i32 64, comdat($source_comdat_variable_1)
49 ; CHECK: $target_comdat_function = comdat any
50 ; CHECK: $target_comdat_function_1 = comdat exactmatch
51 ; CHECK: $target_comdat_variable = comdat largest
52 ; CHECK: $target_comdat_variable_1 = comdat nodeduplicate
54 ; CHECK: @target_variable = external global i32
55 ; CHECK-NOT: @source_variable = external global i32
56 ; CHECK: @target_pattern_variable = external global i32
57 ; CHECK-NOT: @source_pattern_variable = external global i32
58 ; CHECK: @target_pattern_multiple_variable_matches = external global i32
59 ; CHECK-NOT: @source_pattern_multiple_variable_matches = external global i32
60 ; CHECK: @target_comdat_variable = global i32 32, comdat
61 ; CHECK-NOT: @source_comdat_variable = global i32 32, comdat
62 ; CHECK: @target_comdat_variable_1 = global i32 64, comdat
63 ; CHECK-NOT: @source_comdat_variable_1 = global i32 64, comdat
65 ; CHECK: declare void @target_function()
66 ; CHECK-NOT: declare void @source_function()
67 ; CHECK: declare void @target_pattern_function()
68 ; CHECK-NOT: declare void @source_function_pattern_function()
69 ; CHECK: declare void @target_pattern_multiple_function_matches()
70 ; CHECK-NOT: declare void @source_function_pattern_multiple_function_matches()
71 ; CHECK: declare void @naked_target_function()
72 ; CHECK-NOT: declare void @"\01naked_source_function"()
73 ; CHECK-NOT: declare void @"\01__imp__imported_function"()
74 ; CHECK: declare void @"\01__imp_missing_global_leader_prefix"()
75 ; CHECK-NOT: declare void @"\01__imp_DO_NOT_REWRITE"()
77 ; CHECK: declare i32 @renamed_callee()
78 ; CHECK-NOT: declare i32 @first_callee()
79 ; CHECK: declare i32 @second_callee()
80 ; CHECK: define i32 @caller() {
81 ; CHECK: %rhs = call i32 @renamed_callee()
82 ; CHECK-NOT: %rhs = call i32 @first_callee()
83 ; CHECK: %lhs = call i32 @second_callee()
84 ; CHECK: %res = add i32 %rhs, %lhs
88 ; CHECK: define dllexport void @target_comdat_function() comdat
89 ; CHECK-NOT: define dllexport void @source_comdat_function() comdat
90 ; CHECK: define dllexport void @target_comdat_function_1() comdat
91 ; CHECK-NOT: define dllexport void @source_comdat_function_1() comdat