[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:17 PST 2025


================
@@ -3720,9 +3722,8 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
 
       // ExtractValue instructions must be uniform, because the operands are
       // known to be loop-invariant.
-      if (auto *EVI = dyn_cast<ExtractValueInst>(&I)) {
-        assert(IsOutOfScope(EVI->getAggregateOperand()) &&
-               "Expected aggregate value to be loop invariant");
+      auto *EVI = dyn_cast<ExtractValueInst>(&I);
+      if (EVI && IsOutOfScope(EVI->getAggregateOperand())) {
----------------
david-arm wrote:

Hmm, this looks like we're now permitting extracts of any arbitrary input aggregate. Is it worth asserting that when the operand is in scope that it's the result of a call instruction? i.e. something like

```
if (auto *EVI = dyn_cast<ExtractValueInst>(&I) ) {
  if (IsOutOfScope(EVI->getAggregateOperand())) {
    AddToWorklistIfAllowed(EVI);
    continue;
  }
  assert(isa<CallInst>(EVI->getAggregateOperand()) && ...);
}
```

https://github.com/llvm/llvm-project/pull/109833


More information about the llvm-commits mailing list