1; RUN: opt < %s -mtriple=x86_64-unknown-linux -pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s 2; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s 3; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s 4; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s 5 6; Rename Comdat group and its function. 7$f = comdat any 8; CHECK: $f.[[SINGLEBB_HASH:[0-9]+]] = comdat any 9define linkonce_odr void @f() comdat($f) { 10 ret void 11} 12 13; Not rename Comdat with an alias (an alias is an address-taken user). 14$f_with_alias = comdat any 15; CHECK: $f_with_alias = comdat any 16define linkonce_odr void @f_with_alias() comdat { 17 ret void 18} 19@f_alias = alias void (), void ()* @f_with_alias 20 21; Not rename Comdat with right linkage. 22$nf = comdat any 23; CHECK: $nf = comdat any 24define void @nf() comdat($nf) { 25 ret void 26} 27 28; Not rename Comdat with variable members. 29$f_with_var = comdat any 30; CHECK: $f_with_var = comdat any 31@var = global i32 0, comdat($f_with_var) 32define linkonce_odr void @f_with_var() comdat($f_with_var) { 33 %tmp = load i32, i32* @var, align 4 34 %inc = add nsw i32 %tmp, 1 35 store i32 %inc, i32* @var, align 4 36 ret void 37} 38 39; Not rename Comdat with multiple functions. 40$tf = comdat any 41; CHECK: $tf = comdat any 42define linkonce void @tf() comdat($tf) { 43 ret void 44} 45define linkonce void @tf2() comdat($tf) { 46 ret void 47} 48 49; Rename AvailableExternallyLinkage functions 50; CHECK-DAG: $aef.[[SINGLEBB_HASH]] = comdat any 51 52; CHECK: @f = weak alias void (), void ()* @f.[[SINGLEBB_HASH]] 53; CHECK: @aef = weak alias void (), void ()* @aef.[[SINGLEBB_HASH]] 54 55define available_externally void @aef() { 56; CHECK: define linkonce_odr void @aef.[[SINGLEBB_HASH]]() comdat { 57 ret void 58} 59 60 61