[DSE,MSSA] Move reachability check to main loop.
authorFlorian Hahn <flo@fhahn.com>
Sun, 21 Jun 2020 15:34:54 +0000 (16:34 +0100)
committerFlorian Hahn <flo@fhahn.com>
Sun, 21 Jun 2020 15:38:10 +0000 (16:38 +0100)
commit40569db7b3d71b5f4f71108015165c6224b0b242
treec6ecad4d18c93568bc6b594b47f172b943a8608b
parenta45f713c673001abb4fe0612b909c698073eb356
[DSE,MSSA] Move reachability check to main loop.

As we traverse the CFG backwards, we could end up reaching unreachable
blocks. For unreachable blocks, we won't have computed post order
numbers and because DomAccess is reachable, unreachable blocks cannot be
on any path from it.

This fixes a crash with unreachable blocks.
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-unreachable.ll [new file with mode: 0644]