Can you describe the new algorithm in a comment somewhere? I really don't quite have the hang of it, and that makes me worried about maintaining it. http://reviews.llvm.org/D3627