majnemer added a comment. This transform would not be correct if InstCombine removed all the allocas and then started introducing some back. We should make transforms resilient to iteration order. https://reviews.llvm.org/D29688