[llvm] [TTI][RISCV][SLP] Add IdentityConstantValue option to OperandValueKind for use by SLP and RISCV (PR #228630)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 4 02:48:45 PDT 2026
================
@@ -13674,10 +13671,16 @@ TTI::OperandValueInfo BoUpSLP::getOperandInfo(ArrayRef<Value *> Ops) const {
return CI->getValue().isNegatedPowerOf2();
return false;
});
+ const bool IsIdentity = all_of(enumerate(Ops), [&](const auto &Data) {
+ auto *CI = llvm::dyn_cast<llvm::ConstantInt>(Data.value());
+ return CI && CI->getLimitedValue() == Data.index();
+ });
TTI::OperandValueKind VK = TTI::OK_AnyValue;
if (IsConstant && IsUniform)
VK = TTI::OK_UniformConstantValue;
+ else if (IsIdentity)
+ VK = TTI::OK_IdentityConstantValue;
----------------
alexey-bataev wrote:
They mahave different costs for uniform/non-uniform values, like non-uniform may require materialization, while uniform can be used as immediate value
https://github.com/llvm/llvm-project/pull/228630
More information about the llvm-commits
mailing list