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

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 06:20:34 PDT 2019


SjoerdMeijer added a comment.

Last question I guess, I know it defaults to false, and hope I didn't miss it, but perhaps good to have a test too that explicitly sets `-force-hardware-loop-guard=false`?



================
Comment at: lib/CodeGen/HardwareLoops.cpp:329
+  UseLoopGuard |= ForceGuardLoopEntry;
+  if (UseLoopGuard && BB->getSinglePredecessor() &&
+      cast<BranchInst>(BB->getTerminator())->isUnconditional())
----------------
samparker wrote:
> 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.
Ok, got it, thanks!


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

https://reviews.llvm.org/D63809





More information about the llvm-commits mailing list