[PATCH] D70068: [SLP] Enhance SLPVectorizer to vectorize vector aggregate

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 15:59:58 PST 2019


vporpo added a comment.

I think we cannot handle several similar cases with aggregates inside aggregates (e.g., [2 x {float, float}], {{float, float}, {float, float}}). Perhaps we could address some of these cases too with this patch? Please see the tests below:

  ; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s                                                                                                                                                                                       
  
  %StructTy = type { float, float}
  
  define [2 x %StructTy] @ArrayOfStruct(float *%Ptr) {
    %GEP0 = getelementptr inbounds float, float* %Ptr, i64 0
    %L0 = load float, float * %GEP0
    %GEP1 = getelementptr inbounds float, float* %Ptr, i64 1
    %L1 = load float, float * %GEP1
    %GEP2 = getelementptr inbounds float, float* %Ptr, i64 2
    %L2 = load float, float * %GEP2
    %GEP3 = getelementptr inbounds float, float* %Ptr, i64 3
    %L3 = load float, float * %GEP3
  
    %Fadd0 = fadd fast float %L0, 1.1e+01
    %Fadd1 = fadd fast float %L1, 1.2e+01
    %Fadd2 = fadd fast float %L2, 1.3e+01
    %Fadd3 = fadd fast float %L3, 1.4e+01
  
    %StructIn0 = insertvalue %StructTy undef, float %Fadd0, 0
    %StructIn1 = insertvalue %StructTy %StructIn0, float %Fadd1, 1
  
    %StructIn2 = insertvalue %StructTy undef, float %Fadd2, 0
    %StructIn3 = insertvalue %StructTy %StructIn2, float %Fadd3, 1
  
    %Ret0 = insertvalue [2 x %StructTy] undef, %StructTy %StructIn1, 0
    %Ret1 = insertvalue [2 x %StructTy] %Ret0, %StructTy %StructIn3, 1
    ret [2 x %StructTy] %Ret1
  }
  
  define {%StructTy, %StructTy} @StructOfStruct(float *%Ptr) {
    %GEP0 = getelementptr inbounds float, float* %Ptr, i64 0
    %L0 = load float, float * %GEP0
    %GEP1 = getelementptr inbounds float, float* %Ptr, i64 1
    %L1 = load float, float * %GEP1
    %GEP2 = getelementptr inbounds float, float* %Ptr, i64 2
    %L2 = load float, float * %GEP2
    %GEP3 = getelementptr inbounds float, float* %Ptr, i64 3
    %L3 = load float, float * %GEP3
  
    %Fadd0 = fadd fast float %L0, 1.1e+01
    %Fadd1 = fadd fast float %L1, 1.2e+01
    %Fadd2 = fadd fast float %L2, 1.3e+01
    %Fadd3 = fadd fast float %L3, 1.4e+01
  
    %StructIn0 = insertvalue %StructTy undef, float %Fadd0, 0
    %StructIn1 = insertvalue %StructTy %StructIn0, float %Fadd1, 1
  
    %StructIn2 = insertvalue %StructTy undef, float %Fadd2, 0
    %StructIn3 = insertvalue %StructTy %StructIn2, float %Fadd3, 1
  
    %Ret0 = insertvalue {%StructTy, %StructTy} undef, %StructTy %StructIn1, 0
    %Ret1 = insertvalue {%StructTy, %StructTy} %Ret0, %StructTy %StructIn3, 1
    ret {%StructTy, %StructTy} %Ret1
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70068/new/

https://reviews.llvm.org/D70068





More information about the llvm-commits mailing list