I couldn't find anywhere in the code base that checks the bit-pattern so I left it as is. If anyone knows if someone could point me to the code that checks this (if any code does check it) that would be nice.
I was going to ask why make this change, but looking at the patch, it's pretty obvious :-)
Can you move the code that depends on algorithm into a .cpp file?
The PCM hash is reused in CGDebugInfo as the DW_AT_dwo_id hash for the -gmodules debug info. This value is checked by dsymutil and LLDB.
That code is the call to std::copy in the template function so it can't really be moved out... But I removed the include because STLExtras.h already includes it, so I think it is ok to remove the include.
DW_AT_dwo_id is 64 bit so using 0xFF everywhere is fine.
Might be worth writing it down for everyone else - isn't exactly obvious to me (though not a part of the codebase I'm particularly familiar with).
Looks like "Base" is the more common name for this purpose (rather than "BaseT") across the LLVM project. BaseT makes me think (when I'm reading the rest of the code) that's it's a template parameter.
Bit of a big structure to pass by value - should it be by const ref instead? (existing problem with the old code anyway, so no big deal either way)
(also the std::move is a no-op here because std::array<uint32_t> has a move that's the same as copy, though I don't mind it out of habit/consistency)