Commit 371883f46dc23f8464cbf578e2d12a4f92e61917 caused a noticeable compile-time regression (about 0.4% geomean at -O0):
http://llvm-compile-time-tracker.com/compare.php?from=92233159035d1b50face95d886901cf99035bd99&to=371883f46dc23f8464cbf578e2d12a4f92e61917&stat=instructions
To address this switch Scope::DeclSetTy back to a SmallPtrSet and change Sema::ActOnPopScope to explicitly order the diagnostics that this function emits.
I wonder if it would be easy if you just sort here and provide a consistent ordering when iterating?