[PATCH] D63809: [HardwareLoops] Loop counter guard Loop intrinsic

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 05:51:43 PDT 2019


samparker marked an inline comment as done.
samparker added inline comments.


================
Comment at: lib/CodeGen/HardwareLoops.cpp:329
+  UseLoopGuard |= ForceGuardLoopEntry;
+  if (UseLoopGuard && BB->getSinglePredecessor() &&
+      cast<BranchInst>(BB->getTerminator())->isUnconditional())
----------------
SjoerdMeijer wrote:
> I am now actually wondering if we are checking here if the loop is particular kind of loop, i.e. a Single-Entry Single-Exit loop? Or, do we e.g. get this 'guarantee' from SCEV, because otherwise we can't calculate an iteration count? But what happens here if there are multiple predecessors?
There can be multiple exits, but the search for the given exit block is quite odd in my opinion... the exit block that forms the loop has to be executed on every iteration - dominating all other exit blocks. The trip count is given for that exit block.

Multiple predecessors of what...? For the loop preheader, we just don't try to guard the entry and place the normal set.loop.iteration counter in the preheader. I'm wondering whether we could actually use the test.set.loop.iterations in the case of multiple preheader predecessors by placing the intrinsic in all those predecessors.... Something to look at later.


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

https://reviews.llvm.org/D63809





More information about the llvm-commits mailing list