[PATCH] D99203: [RISCV] Add TTI support for cpop with Zbb

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 10:51:03 PDT 2021


frasercrmck accepted this revision.
frasercrmck added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/test/Transforms/LoopIdiom/RISCV/popcnt.ll:29
+; CPOP-NEXT:    br i1 [[TMP2]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]
+; CPOP:       while.body.preheader:
+; CPOP-NEXT:    br label [[WHILE_BODY:%.*]]
----------------
craig.topper wrote:
> frasercrmck wrote:
> > Maybe it's late in the day but I expected there not to be a loop here. Am I missing something?
> LoopIdiomRecognize requires other passes to do the cleanup. The main goal of LoopIdiomRecognize is to rewrite the loop  into countable form. It does this by putting the ctpop outside the loop and decrement it each iteration. Other passes will need to determine that the loop doesn't do anything else and remove it.
Oh yes I see now how the PHIs in `while.end.loopexit` and `while.end` help show that. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99203



More information about the llvm-commits mailing list