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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 10:48:16 PDT 2021


craig.topper added inline comments.


================
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:%.*]]
----------------
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.


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