[llvm] [InstCombine] Infer exact for lshr by cttz (PR #136696)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 23 06:59:26 PDT 2025
================
@@ -994,6 +994,18 @@ static bool setShiftFlags(BinaryOperator &I, const SimplifyQuery &Q) {
I.setIsExact();
return true;
}
+ //Fix #131444
+ if (auto *Cttz = dyn_cast<IntrinsicInst>(I.getOperand(1))) {
+ if (Cttz->getIntrinsicID() == Intrinsic::cttz &&
+ Cttz->getOperand(0) == I.getOperand(0)) {
+ if (auto *Const = dyn_cast<ConstantInt>(Cttz->getOperand(1))) {
+ if (Const->isOne()) {
----------------
houngkoungting wrote:
HI @nikic , I think it has to be this way, because if i8 src = 0 and we shift by 8 bits, it doesn't feel right.
>From https://llvm.org/docs/LangRef.html#llvm-cttz-intrinsic
https://github.com/llvm/llvm-project/pull/136696
More information about the llvm-commits
mailing list