As reported in #144064, this PR added some non-trivial overhead to lit invocations, making development cycle significantly longer.
It was suggested to compute this once and put in some kind of cache to prevent re-evaluations, maybe some lit cache or even CMake, but 22 seconds I measured is still a long time.