[llvm] [TTI][AArch64] Detect OperandInfo from scalable splats. (PR #122469)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 03:33:33 PST 2025
================
@@ -893,7 +893,8 @@ TargetTransformInfo::getOperandInfo(const Value *V) {
// Check for a splat of a constant or for a non uniform vector of constants
// and check if the constant(s) are all powers of two.
- if (isa<ConstantVector>(V) || isa<ConstantDataVector>(V)) {
+ if (isa<ConstantVector>(V) || isa<ConstantDataVector>(V) ||
+ isa<ConstantExpr>(V)) {
----------------
sdesmalen-arm wrote:
Rather than adding another case, which I think makes this sensitive to the plethora of constant subclasses, I think the logic here would be easier to follow if it would be structured as:
```
// Handle splats first since those are all uniform
if (const Value *Splat = getSplatValue(V)) {
if (auto *CI = dyn_cast<ConstantInt>(Splat)) {
OpInfo = OK_UniformConstantValue;
...
} else if (isa<Constant>(Splat))
OpInfo = OK_UniformConstantValue;
else if (isa<Argument>(Splat) || isa<GlobalValue>(Splat))
OpInfo = OK_UniformValue;
} else if (isa<Constant>(V)) {
OpInfo = OK_NonUniformConstantValue;
if (const auto *CDS = dyn_cast<ConstantDataSequential>(V)) {
...
}
}
```
This also allows folding in the argument/global value splats case.
https://github.com/llvm/llvm-project/pull/122469
More information about the llvm-commits
mailing list