HomePhabricator

[NFCI-ish][SimplifyCFGPass] Rework and generalize `ret` block tail-merging

Authored by lebedev.ri on Jun 23 2021, 4:28 AM.

Description

[NFCI-ish][SimplifyCFGPass] Rework and generalize ret block tail-merging

This changes the approach taken to tail-merge the blocks
to always create a new block instead of trying to reuse some block,
and generalizes it to support dealing not with just the ret in the future.

This effectively lifts the CallBr restriction, although this isn't really intentional.
That is the only non-NFC change here, i'm not sure if it's reasonable/feasible to temporarily retain it.

Other restrictions of the transform remain.

Reviewed By: rnk

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