OSDN Git Service

[ConstantHoisting] avoid hang/crash from unreachable blocks (PR40930)
authorSanjay Patel <spatel@rotateright.com>
Mon, 4 Mar 2019 20:57:14 +0000 (20:57 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 4 Mar 2019 20:57:14 +0000 (20:57 +0000)
commit080999b5bba8f25ea75eda88e0fe305aaeae7669
treec6b6c25cc304efa653694e0c5804ae05e12c9e04
parent0d5bf69c9c2ad14ede31b91a30d3bd0dc47003d0
[ConstantHoisting] avoid hang/crash from unreachable blocks (PR40930)

I'm not too familiar with this pass, so there might be a better
solution, but this appears to fix the degenerate:
PR40930
PR40931
PR40932
PR40934
...without affecting any real-world code.

As we've seen in several other passes, when we have unreachable blocks,
they can contain semi-bogus IR and/or cause unexpected conditions. We
would not typically expect these patterns to make it this far, but we
have to guard against them anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355337 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/ConstantHoisting.cpp
test/Transforms/ConstantHoisting/X86/bad-cases.ll