[llvm] [AMDGPU] Recognize uniform expressions on tidx (PR #178533)
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 28 15:59:50 PST 2026
================
@@ -1628,5 +1628,26 @@ GCNTTIImpl::getInstructionUniformity(const Value *V) const {
if (isSourceOfDivergence(V))
return InstructionUniformity::NeverUniform;
+ if (!ST->isWaveSizeKnown())
+ return InstructionUniformity::Default;
+
+ using namespace PatternMatch;
+ uint64_t C;
+ if (match(V, m_LShr(m_Intrinsic<Intrinsic::amdgcn_workitem_id_x>(),
+ m_ConstantInt(C))) &&
+ C >= ST->getWavefrontSizeLog2())
+ return InstructionUniformity::AlwaysUniform;
+
+ uint64_t LaneMask = ST->getWavefrontSize() - 1;
+ if (match(V, m_And(m_Intrinsic<Intrinsic::amdgcn_workitem_id_x>(),
----------------
rampitec wrote:
By convention constant is always RHS. LLVM takes care of it.
https://github.com/llvm/llvm-project/pull/178533
More information about the llvm-commits
mailing list