[llvm] AMDGPU: Add range attribute to mbcnt intrinsic callsites (PR #189191)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 06:36:46 PDT 2026
================
@@ -1422,11 +1422,31 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
break;
}
- case Intrinsic::amdgcn_mbcnt_hi: {
+ case Intrinsic::amdgcn_mbcnt_hi:
// exec_hi is all 0, so this is just a copy.
if (ST->isWave32())
return IC.replaceInstUsesWith(II, II.getArgOperand(1));
- break;
+ [[fallthrough]];
+ case Intrinsic::amdgcn_mbcnt_lo: {
+ ConstantRange AccRange = computeConstantRange(II.getArgOperand(1),
+ /*ForSigned=*/false);
+ if (AccRange.isFullSet())
+ return nullptr;
+
+ // TODO: Can raise upper bound by inspecting first argument.
----------------
ruiling wrote:
I mean we may not need https://github.com/llvm/llvm-project/commit/686987a540bc176bceaad43ffe530cb3e88796d5 after this change. I will have a try after you merge this one.
By inspecting the first argument, we have chance to raise the lower bound or reduce the upper bound. But cannot `raise upper bound`. Seems you made a typo here. Could you fix before submit?
https://github.com/llvm/llvm-project/pull/189191
More information about the llvm-commits
mailing list