[PATCH] D32605: Recognize CTLZ builtin

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 11:22:59 PDT 2017


evstupac created this revision.
Herald added a subscriber: mzolotukhin.

The patch targeted to recognize and replace with ctlz (make countable) loops like:

while(n) {

  n >>= 1;
  i++;
  body();

}
use(i);

Should be replaced with:
ii = type_bitwidth(n) - ctlz(n);
for(j = 0; j < ii; j++) {
 body();
}
use(ii + i)


Repository:
  rL LLVM

https://reviews.llvm.org/D32605

Files:
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  test/Transforms/LoopIdiom/ctlz.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32605.96950.patch
Type: text/x-patch
Size: 16753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170427/985dde7e/attachment.bin>


More information about the llvm-commits mailing list