[CodeMoverUtils] Added an API to check if an instruction can be safely
authorTsang Whitney W.H <whitneyt@recycler.canlab.ibm.com>
Fri, 22 Nov 2019 21:27:29 +0000 (21:27 +0000)
committerTsang Whitney W.H <whitneyt@recycler.canlab.ibm.com>
Fri, 22 Nov 2019 21:29:08 +0000 (21:29 +0000)
commitae8a8c2db6c176b4dae679b77e566c656c2a27c6
treeb96135c23033f8b00d4bd4bff2f8cad122509d3b
parent48b7fe02a1147a734ba8b28f53b4b7ede30d0843
[CodeMoverUtils] Added an API to check if an instruction can be safely
moved before another instruction.
Summary:Added an API to check if an instruction can be safely moved
before another instruction. In future PRs, we will like to add support
of moving instructions between blocks that are not control flow
equivalent, and add other APIs to enhance usability, e.g. moving basic
blocks, moving list of instructions...
Loop Fusion will be its first user. When there is intervening code in
between two loops, fusion is currently unable to fuse them. Loop Fusion
can use this utility to check if the intervening code can be safely
moved before or after the two loops, and move them, then it can
successfully fuse them.
Reviewer:kbarton,jdoerfert,Meinersbur,bmahjour,etiotto
Reviewed By:bmahjour
Subscribers:mgorny,hiraditya,llvm-commits
Tag:LLVM
Differential Revision:https://reviews.llvm.org/D70049
llvm/include/llvm/Analysis/PostDominators.h
llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h [new file with mode: 0644]
llvm/lib/Analysis/PostDominators.cpp
llvm/lib/Transforms/Utils/CMakeLists.txt
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp [new file with mode: 0644]
llvm/unittests/Transforms/Utils/CMakeLists.txt
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp [new file with mode: 0644]