As indicated in D18612, sample-based profiling and optimization remarks currently remove DICompileUnits from llvm.dbg.cu to suppress the emission of debug info from them. This is somewhat of a hack and only borderline legal IR.
This patch uses the recently introduced NoDebug emission kind in DICompileUnit to achieve the same result without breaking the Verifier. A nice side-effect of this change is that it is now possible to combine NoDebug and regular compile units under LTO.
For simplicity I combined the llvm and cfe patches into one review.
Instead of this pattern would it make more sense to have an iterator over the nodes that checks for !NoDebug?