[PATCH] D102675: [SLP] Fix "gathering" of vector values
Anton Afanasyev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 22 12:35:18 PDT 2021
anton-afanasyev marked 3 inline comments as done.
anton-afanasyev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3693-3695
+ // No cost for "gathering" already vector value
+ if (isa<FixedVectorType>(VL[0]->getType()))
+ return 0;
----------------
ABataev wrote:
> Not sure we should return `0` here, maybe better to return some max cost, like `INT_MAX`?
There is no difference for now (the only one is compile time). We could also just prohibit marking `NeedToGather` for vector node (it could be done while checking for ephemeral values only).
But I've done it this way since it looks more transparent and also we could use zero cost for the future cases when/if such `NeedToGather` vector node is not the only member of tree and whole tree vectorization is beneficial.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4597-4599
+ // "Gathering" of vector values is already done
+ if (isa<FixedVectorType>(Val0->getType()))
+ return Val0;
----------------
ABataev wrote:
> Is this correct? Need to return the last insertelement instruction in the sequence
Sure, fixed!
================
Comment at: llvm/test/Transforms/SLPVectorizer/X86/insert-element-build-vector-inseltpoison.ll:45-80
-; CHECK-LABEL: @simple_select_eph(
-; CHECK-NEXT: [[C0:%.*]] = extractelement <4 x i32> [[C:%.*]], i32 0
-; CHECK-NEXT: [[C1:%.*]] = extractelement <4 x i32> [[C]], i32 1
-; CHECK-NEXT: [[C2:%.*]] = extractelement <4 x i32> [[C]], i32 2
-; CHECK-NEXT: [[C3:%.*]] = extractelement <4 x i32> [[C]], i32 3
-; CHECK-NEXT: [[A0:%.*]] = extractelement <4 x float> [[A:%.*]], i32 0
-; CHECK-NEXT: [[A1:%.*]] = extractelement <4 x float> [[A]], i32 1
----------------
ABataev wrote:
> Why the check lines are removed?
Fixed
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102675/new/
https://reviews.llvm.org/D102675
More information about the llvm-commits
mailing list