UpdatePHINodes in BasicBlockUtils should not crash on duplicate predecessors
authorHal Finkel <hfinkel@anl.gov>
Fri, 4 Oct 2013 23:41:05 +0000 (23:41 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 4 Oct 2013 23:41:05 +0000 (23:41 +0000)
commitfc3b7bbf49086e827a628e22db0b75e46c151d17
tree7c99ac7016f0bea8e6fb517a9bdc829bafda3013
parent356ccdceed31f84472e58df56da65b2f4f6ab72f
UpdatePHINodes in BasicBlockUtils should not crash on duplicate predecessors

UpdatePHINodes has an optimization to reuse an existing PHI node, where it
first deletes all of its entries and then replaces them. Unfortunately, in the
case where we had duplicate predecessors (which are allowed so long as the
associated PHI entries have the same value), the loop removing the existing PHI
entries from the to-be-reused PHI would assert (if that PHI was not the one
which had the duplicates).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192001 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/BasicBlockUtils.cpp
test/Transforms/LoopSimplify/dup-preds.ll [new file with mode: 0644]