[SimplifyCFG] Improve the way hoisting skips over non-matching instructions
authorJay Foad <jay.foad@amd.com>
Thu, 27 Apr 2023 15:55:24 +0000 (16:55 +0100)
committerJay Foad <jay.foad@amd.com>
Fri, 28 Apr 2023 09:03:32 +0000 (10:03 +0100)
commit31ec0a6845299dc3486c1339d40342d858a42e3f
tree91b203690f4fee62dcdf0bb3558c6b7cd5aea946
parent103fc0f629aa6218783f65dff0197f257137cade
[SimplifyCFG] Improve the way hoisting skips over non-matching instructions

D129370 introduced the idea that hoisting could skip over non-matching
instructions and continue to look for matching (hoistable) instructions,
but certain types of mismatch still aborted the whole hoisting attempt.

Fix this by splitting out some of the instruction matching checks into a
helper function.

Also forbid hoisting allocas past stacksave/stackrestore, completing the
fix started in D133730, to avoid regressing tests.

Differential Revision: https://reviews.llvm.org/D149365
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/convergent.ll