[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 03:42:18 PST 2025
================
@@ -115,6 +115,13 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPWidenRecipe *R) {
case Instruction::FNeg:
case Instruction::Freeze:
return inferScalarType(R->getOperand(0));
+ case Instruction::ExtractValue: {
+ assert(R->getNumOperands() == 2 && "expected single level extractvalue");
+ auto *StructTy = cast<StructType>(inferScalarType(R->getOperand(0)));
+ auto *CI = cast<ConstantInt>(R->getOperand(1)->getLiveInIRValue());
+ unsigned Idx = CI->getZExtValue();
+ return StructTy->getTypeAtIndex(Idx);
----------------
david-arm wrote:
Perhaps simply to just fold these two lines into:
```
return StructTy->getTypeAtIndex(CI->getZExtValue());
```
https://github.com/llvm/llvm-project/pull/109833
More information about the llvm-commits
mailing list