[PATCH] D60096: [InstCombine] Simplify ctlz/cttz with bitreverse
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 2 12:44:03 PDT 2019
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - thanks!
================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1333-1336
+ return IC.replaceInstUsesWith(
+ II,
+ IC.Builder.CreateBinaryIntrinsic(
+ IsTZ ? Intrinsic::ctlz : Intrinsic::cttz, X, II.getArgOperand(1)));
----------------
Might be less hassle to not to use the builder directly:
```
Intrinsic::ID ID = IsTZ ? Intrinsic::ctlz : Intrinsic::cttz;
Function *F = Intrinsic::getDeclaration(II.getModule(), ID, II.getType());
return CallInst::Create(F, { X, II.getArgOperand(1) });
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60096/new/
https://reviews.llvm.org/D60096
More information about the llvm-commits
mailing list