Fix an ordering bug in the scalarizer.
authorNeil Henning <neil.henning@amd.com>
Wed, 10 Oct 2018 09:27:45 +0000 (09:27 +0000)
committerNeil Henning <neil.henning@amd.com>
Wed, 10 Oct 2018 09:27:45 +0000 (09:27 +0000)
commit3d4579829e85c108e729ade64d778e614b702e16
tree6a5e370a5878810018613d094cea47a8f9d8384d
parent0c17cbf790cde9ed33b3f225b460194d27b2021a
Fix an ordering bug in the scalarizer.

I've added a new test case that causes the scalarizer to try and use
dead-and-erased values - caused by the basic blocks not being in
domination order within the function. To fix this, instead of iterating
through the blocks in function order, I walk them in reverse post order.

Differential Revision: https://reviews.llvm.org/D52540

llvm-svn: 344128
llvm/lib/Transforms/Scalar/Scalarizer.cpp
llvm/test/Transforms/Scalarizer/crash-bug.ll
llvm/test/Transforms/Scalarizer/order-bug.ll [new file with mode: 0644]
llvm/test/Transforms/Scalarizer/phi-bug.ll [new file with mode: 0644]