[llvm] [AMDGPU][InstCombine] Optimize constant shuffle patterns (PR #192246)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 04:17:39 PDT 2026
================
@@ -718,6 +657,331 @@ GCNTTIImpl::hoistLaneIntrinsicThroughOperand(InstCombiner &IC,
return nullptr;
}
+static std::optional<unsigned> evalLaneExpr(Value *V, unsigned Lane,
+ const GCNSubtarget &ST,
+ const DataLayout &DL,
+ unsigned Depth = 0) {
+ if (Depth >= MaxAnalysisRecursionDepth)
+ return std::nullopt;
+
+ if (isThreadID(ST, V))
+ return Lane;
+
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
+ return CI->getZExtValue();
----------------
arsenm wrote:
```suggestion
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
return CI->getZExtValue();
if (isThreadID(ST, V))
return Lane;
```
https://github.com/llvm/llvm-project/pull/192246
More information about the llvm-commits
mailing list