The instruction extractelement/extractvalue are not required to
be scheduled since they only depend on the source vector/aggregate (with
constant indices), smae applies to the parent basic block checks.
Improves compile time and saves scheduling budget.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll | ||
---|---|---|
19–25 | Passing-by remark: i suspect the extract/insert aren't needed here, |
It looks like this patch causes an issue reported here: https://lists.llvm.org/pipermail/llvm-dev/2021-August/152411.html. Reverting fixes it.
Are you able to see a quick fix? Otherwise we may need to revert and commit the test case for it to be addressed when @ABataev is back.
Are you able to see a quick fix? Otherwise we may need to revert and commit the test case for it to be addressed when @ABataev is back.
Yes, I'm looking for a quick fix. I've answered to thread that I'm to revert it if no fix in a short time.
Looks like it crashes on shuffles, just need to add a check for shuffles in assert.
No, it crashes on extractelement with non-constant index. I've commented this inline.
The current crash could just be fixed by removing one assert check, but I've found several more minors, so may be it worth to revert? I think this should be recommited with negative tests for extractelement as wel as for insertelement (are we able to schedule insertelement with non-constant index now?)
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
222 | Btw, this second ExtractValueInst is redundant, it's checked above. | |
235 | Why do we need this bypass? Looks like this check isn't related to allSameBlock(). One can imagine vector-like-insts with const ops in different BBs. We can explicitly do this check outside allSameBlock() wherever need. | |
6576 | all_of(VL, isVectorLikeInstWithConstOps) should be here instead? | |
6672 | all_of(VL, isVectorLikeInstWithConstOps) should be here instead as well? | |
6712–6714 | We assert here for bundle member not being vector-like-inst-with-const-ops, but check only S.OpValue before in tryScheduleBundle(). Remove this new check? |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
222 | No, it is required and checks for a different thing. It checks that the index is constant for such instructions. | |
235 | Because we don't need to check the parents for such instructions. For InsertsElements it was checked already, for Undefs - no need, for Extracts with constant indices - not required. | |
6576 | No, not needed, just isVectorLikeInstWithConstOps(S.OpValue) is enough. Moreover, if we have inserts/extracts with non-const indices, they should be gathered, we can't vectorize them. Just added a special check in BoUpSLP::buildTree_rec function. | |
6672 | Same as above | |
6712–6714 | No, the assert is correct, we should allow extracts with const indices to be scheduled. It is fixed by the mentioned additional check in BoUpSLP::buildTree_rec |
Please rebase against llvm/test/Transforms/SLPVectorizer/X86/extract_with_non_const_index.ll commited at aaae726afb0ef.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
222 | But you've made check already at line 217, haven't you? Return true for any index if isa<ExtractValueInst>(I). |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
222 | Oh, yes, missed that you meant ExtractValueInst. Yes, need to remove the check for ExtractValueInst here, it cannot have non-const indices per LLVM IR specification. |
Add description comment