See https://bugs.llvm.org/show_bug.cgi?id=35533, and D40844
Things covered:
- Removing duplicate data segments (as determined by COMDATs emitted by the frontend)
- Removing duplicate globals and functions in COMDATs
- Checking that each time a COMDAT is seen it has the same symbols as at other times (ie it's a stronger check than simply giving all the symbols in the COMDAT weak linkage)
I guess this could be a local lambda function since its just used in one function?