We came across a case where compiling one file (of many) in a customer application took 1m24s with a Release build vs 10s with a Release+Asserts build. The problem is that RegionBase<Tr>::getNameStr() is very expensive when the region's entry or exit block doesn't have a name, which is the case in the Release build as clang doesn't preserve names. The main use of RegionBase<Tr>::getNameStr() is to generate the message string when calling dumpPassInfo. This fix just adds the check that we are actually generating debug pass information, and thus avoids the call to RegionBase<Tr>::getNameStr() otherwise. With this change, the compile time for a Release only build goes down to 8s.
The long compile time will still be present when -debug-pass flag is used in a Release build. If that should also be fixed, perhaps we can just create an empty string upfront if NDEBUG is set and the region's entry or exit block doesn't have a name.