[PATCH] D92385: [ARM] Add a pass that re-arranges blocks when there is a backwards WLS branch

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 07:18:24 PST 2020


samparker added inline comments.


================
Comment at: llvm/lib/Target/ARM/ARMLowOverheadLoopBlockPlacement.cpp:61
+
+bool ARMLowOverheadLoopBlockPlacement::canMoveBasicBlock(
+    MachineBasicBlock *BB, MachineBasicBlock *To) {
----------------
samtebbs wrote:
> samparker wrote:
> > Looks like you're duplicating work here:
> > - iterating through BB twice to find t2WhileLoopStart
> > - extra call to blockIsBefore?
> > Looks like you're duplicating work here:
> > - iterating through BB twice to find t2WhileLoopStart
> Reckon I should be caching where I find a t2WhileLoopStart to avoid looping where possible? I assume you're referring to the single loop in blockIsBefore and the single loop in runOnMachineFunction.
> > - extra call to blockIsBefore?
> The reason why there are two calls to blockIsBefore is because we don't care if moving the block results in a backwards branch if it is a backwards branch even without the move.
I'd just try moving this logic into the main loop in runOnMachineFunction, should still be perfectly readable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92385/new/

https://reviews.llvm.org/D92385



More information about the llvm-commits mailing list