[llvm] AMDGPU: Add range attribute to mbcnt intrinsic callsites (PR #189191)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 06:51:13 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.
----------------
arsenm wrote:
Also I think this is more of an API failure. computeKnownConstantRange should unconditionally fall back on computeKnownBits instead of having an arbitrarily different entry point
https://github.com/llvm/llvm-project/pull/189191
More information about the llvm-commits
mailing list