[PATCH] D66529: [LOOPGUARD] Disable loop with multiple loop exiting blocks.

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 15:32:14 PDT 2019


Whitney added a comment.

> Any reason not to use Loop::getExitBlock()? The behavior is different when there are are multiple exiting edges to the same block, but does it matter? Maybe we should change Loop::getExitBlock() to only return nullptr if two different exit blocks exist, as e.g. getLoopPredecessor() already does.

Originally I used getExitBlock(), and found that the new test case `MultiExitingLoop` failed to find the loop guard, as getExitBlock() returns nullptr if there are more than one exiting block, even if all exiting blocks go to the same exit block. As the reason we want to add an early exit is because we don't check post dominations for all exit blocks, we don't need to exit early if there is only one unique exit block. I don't know if it matters, but more loops can find their guard in this way.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66529





More information about the llvm-commits mailing list