This patch moves OrderedInstructions to CodeMoverUtils as It was the only place where OrderedInstructions is required.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
You don't need an actual OrderedInstructions class. You can simply make domTreeLevelBefore() a static function in CodeMoverUtils.cpp. Replace the localDominates() call with Instruction::comesBefore().
Moving OrderedInstructions functions to CodeMoverUtils.cpp and making them static doesn't allow the unittest to pass! The unittest requires the call of "dominates" and the only way to fulfill is to define "dominates" into CodeMoverUtils.h which is not the preferred step!
Not sure I follow. As far as I know, OrderedInstructions::dominates() is same as DominatorTree::dominates() at this point, so you can just use the DominatorTree method. I'm also not sure what the added DominanceTest is force. It doesn't seem related to CodeMoverUtils and only tests dominance queries, for which we already have dedicated domtree construction tests.
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
103 | No need, is not doing anything extra compare to DominatorTree::dominates defined in lib/IR/Dominators.cpp | |
116 | As suggested by @nikic , change this call to comesBefore. And remove OrderedInstructions::localDominates. | |
119 | Did you accidentally removed the line: return DA->getLevel() < DB->getLevel();? | |
333 | Please update the base of your diff. It is already calling domTreeLevelBefore before this patch. | |
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp | ||
652 | remove this test. |
This update removes the OrderedInstructions class from CodeMoverUtils and also removes it's exposure to other transformation passes, both localDominates and domTreeLevelBefore is made as static functions and are present in CodeMoverUtils.cpp. OrderedInstructions::dominates() has been removed from CodeMoverUtils.cpp due to it's existance in DominatorTree::dominates(), the dominance test moved from OrderedInstructionsTest.cpp to CodeMoverUtilsTest.cpp is also removed.
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
96 | Am I right that function localDominates is now dead? If so, can you remove it as well? |
This update removes localDominates which is not required, only one OrderedInstructions is required which is domTreeLevelBefore which is now a part of CodeMoverUtils.cpp
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
358 | Why const is removed? |
Am I right that function localDominates is now dead? If so, can you remove it as well?