[JumpThreading] Stop searching predecessor when the current bb is in a
authorWei Mi <wmi@google.com>
Fri, 26 Jul 2019 20:59:22 +0000 (20:59 +0000)
committerWei Mi <wmi@google.com>
Fri, 26 Jul 2019 20:59:22 +0000 (20:59 +0000)
commit55a68a24003a08f37e0d4704c8d89cd2c3f9f095
treeff5f8b227d9ea3b76e2d749f3d4e73bb076f374b
parentfe4b12b4deacb9b8fe9ee9887e6a897a7e955ff9
[JumpThreading] Stop searching predecessor when the current bb is in a
unreachable loop.

updatePredecessorProfileMetadata in jumpthreading tries to find the
first dominating predecessor block for a PHI value by searching upwards
the predecessor block chain.

But jumpthreading may see some temporary IR state which contains
unreachable bb not being cleaned up. If an unreachable loop happens to
be on the predecessor block chain, keeping chasing the predecessor
block will run into an infinite loop.

The patch fixes it.

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

llvm-svn: 367154
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/test/Transforms/JumpThreading/unreachable-loops.ll [new file with mode: 0644]