[llvm] [LV] Teach LoopVectorizationLegality about struct vector calls (PR #119221)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 14:42:22 PST 2024


================
@@ -943,11 +955,22 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
       if (CI && !VFDatabase::getMappings(*CI).empty())
         VecCallVariantsFound = true;
 
+      auto CanWidenInstruction = [this](Instruction const &Inst) {
+        Type *InstTy = Inst.getType();
+        if (isa<CallInst>(Inst) && isa<StructType>(InstTy) &&
+            canWidenCallReturnType(InstTy)) {
+          StructVecCallFound = true;
+          // For now, we can only widen struct values returned from calls where
+          // all users are extractvalue instructions.
+          return llvm::all_of(Inst.users(), IsaPred<ExtractValueInst>);
----------------
fhahn wrote:

```suggestion
          return all_of(Inst.users(), IsaPred<ExtractValueInst>);
```

`llvm::` should also not be needed

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


More information about the llvm-commits mailing list