[UnifyFunctionExitNodes] Fix Modified status for unreachable blocks
authorDavid Stenberg <david.stenberg@ericsson.com>
Wed, 9 Sep 2020 08:59:41 +0000 (10:59 +0200)
committerDavid Stenberg <david.stenberg@ericsson.com>
Wed, 9 Sep 2020 11:36:03 +0000 (13:36 +0200)
commit48fc781438767bd8337facf2e232c695b0426fb4
tree26a73e2e8e60b76d9570aaf605c0ab9cde9054e5
parent36c8621638d18c830efe2c6a2a6d0a0338b0f79d
[UnifyFunctionExitNodes] Fix Modified status for unreachable blocks

If a function had at most one return block, the pass would return false
regardless if an unified unreachable block was created.

This patch fixes that by refactoring runOnFunction into two separate
helper functions for handling the unreachable blocks respectively the
return blocks, as suggested by @bjope in a review comment.

This was caught using the check introduced by D80916.

Reviewed By: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D85818
llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
llvm/test/Transforms/UnifyFunctionExitNodes/unreachable-blocks-status.ll [new file with mode: 0644]