[PATCH] D57059: [SLP] Initial support for the vectorization of the non-power-of-2 vectors.

Dinar Temirbulatov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 15:27:17 PDT 2020


dtemirbulatov added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4813
         Type *VL0Ty = VL0->getOperand(j)->getType();
         Type *Ty = llvm::all_of(
                        VL, [VL0Ty](Value *V) { return VL0Ty == V->getType(); })
----------------
dtemirbulatov wrote:
> hmm, it might be unsafe to try to obtain type here since any element of VL could be Undef?
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@e = dso_local local_unnamed_addr global i32 0, align 4
@f = dso_local local_unnamed_addr global i32 0, align 4

; Function Attrs: nofree norecurse nounwind uwtable
define dso_local i32 @g() local_unnamed_addr #0 {
entry:
  %0 = load i32, i32* @e, align 4
  %tobool.not19 = icmp eq i32 %0, 0
  br i1 %tobool.not19, label %while.end, label %while.body

while.body:                                       ; preds = %entry, %while.body.backedge
  %c.022 = phi i32* [ %c.022.be, %while.body.backedge ], [ undef, %entry ]
  %b.021 = phi i32* [ %b.021.be, %while.body.backedge ], [ undef, %entry ]
  %a.020 = phi i32* [ %a.020.be, %while.body.backedge ], [ undef, %entry ]
  %incdec.ptr = getelementptr inbounds i32, i32* %c.022, i64 1
  %1 = ptrtoint i32* %c.022 to i64
  %2 = trunc i64 %1 to i32
  %incdec.ptr1 = getelementptr inbounds i32, i32* %a.020, i64 1
  %incdec.ptr2 = getelementptr inbounds i32, i32* %b.021, i64 1
  switch i32 %2, label %while.body.backedge [
    i32 2, label %sw.bb
    i32 4, label %sw.bb6
  ]

sw.bb:                                            ; preds = %while.body
  %incdec.ptr3 = getelementptr inbounds i32, i32* %b.021, i64 2
  %3 = ptrtoint i32* %incdec.ptr2 to i64
  %4 = trunc i64 %3 to i32
  %incdec.ptr4 = getelementptr inbounds i32, i32* %a.020, i64 2
  store i32 %4, i32* %incdec.ptr1, align 4
  %incdec.ptr5 = getelementptr inbounds i32, i32* %c.022, i64 2
  br label %while.body.backedge

sw.bb6:                                           ; preds = %while.body
  %incdec.ptr7 = getelementptr inbounds i32, i32* %a.020, i64 2
  %incdec.ptr8 = getelementptr inbounds i32, i32* %c.022, i64 2
  %5 = ptrtoint i32* %incdec.ptr to i64
  %6 = trunc i64 %5 to i32
  %incdec.ptr9 = getelementptr inbounds i32, i32* %b.021, i64 2
  store i32 %6, i32* %incdec.ptr2, align 4
  br label %while.body.backedge

while.body.backedge:                              ; preds = %sw.bb6, %while.body, %sw.bb
  %c.022.be = phi i32* [ %incdec.ptr, %while.body ], [ %incdec.ptr8, %sw.bb6 ], [ %incdec.ptr5, %sw.bb ]
  %b.021.be = phi i32* [ %incdec.ptr2, %while.body ], [ %incdec.ptr9, %sw.bb6 ], [ %incdec.ptr3, %sw.bb ]
  %a.020.be = phi i32* [ %incdec.ptr1, %while.body ], [ %incdec.ptr7, %sw.bb6 ], [ %incdec.ptr4, %sw.bb ]
  br label %while.body

while.end:                                        ; preds = %entry
  ret i32 undef
}

attributes #0 = { nofree norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+avx,+avx2,+cx8,+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave" "unsafe-fp-math"="false" "use-soft-float"="false" }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57059





More information about the llvm-commits mailing list