jdoerfert added a comment. I think I could write this patch a little differently and we would never build any dead PHIs. However, that would require backtracking instead which might or might not turn out to be faster. http://reviews.llvm.org/D15722