When finding locations for variable values at the start of a block, we build a large map of every value to every location, and then pick out the locations for values that are desired. This takes up quite a lot of time, because, unsurprisingly, there are usually more values in registers and stack slots than there are variables.
This patch instead creates a map of desired values to their locations, which are initially illegal locations. Then, as we examine every available value, we can select locations for values we care about, and ignore those that we don't. This substantially reduces the amount of work done (i.e., building a map up of values to locations that nothing wants or needs).
Geomean performance improvement of 1%: http://llvm-compile-time-tracker.com/compare.php?from=427eff43fcd470caa5cf44e10188c50f89b93af8&to=842aefd941f8e5f2d73b3178fdbbd7d27df9c55a&stat=instructions
Hmm... can ValuesPreferredLoc == ValueToLoc.end() ever be true now, with this patch?