1 ; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s
2 ; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s
4 ; Rename Comdat group and its function.
6 ; CHECK: $f.[[SINGLEBB_HASH:[0-9]+]] = comdat any
7 define linkonce_odr void @f() comdat($f) {
11 ; Not rename Comdat with an alias (an alias is an address-taken user).
12 $f_with_alias = comdat any
13 ; CHECK: $f_with_alias = comdat any
14 define linkonce_odr void @f_with_alias() comdat {
17 @f_alias = alias void (), ptr @f_with_alias
19 ; Not rename Comdat with right linkage.
21 ; CHECK: $nf = comdat any
22 define void @nf() comdat($nf) {
26 ; Not rename Comdat with variable members.
27 $f_with_var = comdat any
28 ; CHECK: $f_with_var = comdat any
29 @var = global i32 0, comdat($f_with_var)
30 define linkonce_odr void @f_with_var() comdat($f_with_var) {
31 %tmp = load i32, ptr @var, align 4
32 %inc = add nsw i32 %tmp, 1
33 store i32 %inc, ptr @var, align 4
37 ; Not rename Comdat with multiple functions.
39 ; CHECK: $tf = comdat any
40 define linkonce void @tf() comdat($tf) {
43 define linkonce void @tf2() comdat($tf) {
47 ; Rename AvailableExternallyLinkage functions
48 ; CHECK-DAG: $aef.[[SINGLEBB_HASH]] = comdat any
50 ; CHECK: @f = weak alias void (), ptr @f.[[SINGLEBB_HASH]]
51 ; CHECK: @aef = weak alias void (), ptr @aef.[[SINGLEBB_HASH]]
53 define available_externally void @aef() {
54 ; CHECK: define linkonce_odr void @aef.[[SINGLEBB_HASH]]() comdat {