[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 05:28:06 PST 2024


================
@@ -3667,9 +3669,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");
+      if (auto *EVI = dyn_cast<ExtractValueInst>(&I);
----------------
david-arm wrote:

Perhaps this is just personal opinion, but I'm not really keen on multi-statement if conditions as I find it a bit confusing to read. I haven't seen other examples this elsewhere in LLVM, although I could be wrong! I thought it was more in keeping with LLVM style to write something like:

```
  auto *EVI = dyn_cast<ExtractValueInst>(&I);
  if (EVI && IsOutOfScope(EVI->getAggregateOperand()))
```
?

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


More information about the llvm-commits mailing list