After r153410, the function cloner started to fold some constants in the cloned code after all of the basic blocks had been cloned into the new function. As a consequence, this folding could form dead basic blocks that need to actually be pruned (rather than simply avoiding cloning them in the first place).<div>
<br></div><div>Doing this requires changing the value map used by the cloner to use WeakVHs rather than TrackingVHs. It seems this more closely matches the intended semantics any ways, as several clients of these value maps check for null mapped values as a way of detected deleted entities. With WeakVH this "just works". Without it, it requires an expensive update of the value mapping in order to delete code from it.</div>
<div><br></div><div>I've attached a patch which does this, and adds the necessary code to fold terminators and prune dead blocks in the function cloner. I suspect there are a few other simplifications that can be made due tho the WeakVH model, but I've not looked for them aggressively. Everything seems to work with this. What do others think?</div>