The original review is: Differential Revision: http://reviews.llvm.org/D15540
I reverted the commit r260164 because it broke one darwin test in compile-rt/profile/
The reason for the breakage is Mach-O platform doesn’t support COMDATs. In this revised patch, I create a linkonce variable for the MachO platform and remain to create a comdat variable for other platforms.
I change the test Transform/PGOInstrumentation/branch1.ll to test linkonce variable creation.
Other part of the patch is the same.
Tested the patch in Marbook pro and Linux.
Thanks,
-Rong
Why not linkonceODR -- the version var generated in each TU needs to be the same.