[CodeMoverUtils] Enhance isSafeToMoveBefore() when moving BBs
authorCongzhe Cao <congzhe.cao@huawei.com>
Fri, 24 Sep 2021 09:40:58 +0000 (05:40 -0400)
committerCongzheUalberta <congzhecao@gmail.com>
Fri, 24 Sep 2021 09:48:15 +0000 (05:48 -0400)
commit751be2a064f119af74c7b9b1e52bc904d8aa114d
tree67387dfa78a816a11ef10fed03a5244ee8dc62bb
parent7e46a721fc7ea46f72a4fcf81062a76d6539f61d
[CodeMoverUtils] Enhance isSafeToMoveBefore() when moving BBs

When moving an entire basic block BB before InsertPoint, currently
we check for all instructions whether the operands dominates
InsertPoint, however, this can be improved such that even an
operand does not dominate InsertPoint, as long as it appears as
a previous instruction in the same BB, it is safe to move.

Reviewed By: Whitney

Differential Revision: https://reviews.llvm.org/D110378
llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp