This is an archive of the discontinued LLVM Phabricator instance.

[SLP] Add test to check for GEP vectorization
ClosedPublic

Authored by zjaffal on Mar 21 2023, 9:21 AM.

Details

Summary

add a test to check for gep vectorization after the change from D144128 where the gep vectorization is dependant on the target hook prefersVectorizedAddressing()

Diff Detail

Event Timeline

zjaffal created this revision.Mar 21 2023, 9:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2023, 9:22 AM
zjaffal requested review of this revision.Mar 21 2023, 9:22 AM
fhahn requested changes to this revision.Mar 22 2023, 3:45 AM

Looks like the test is failing in the precommit checks.

llvm/test/Transforms/SLPVectorizer/AArch64/getelementptr.ll
6 ↗(On Diff #507017)

Why is the new run line needed?

This revision now requires changes to proceed.Mar 22 2023, 3:45 AM
zjaffal updated this revision to Diff 507392.Mar 22 2023, 9:21 AM

Move function from AArch64 to be a generic test.

zjaffal updated this revision to Diff 507403.Mar 22 2023, 9:45 AM

move the file back to AArch64

fhahn added inline comments.Mar 27 2023, 5:11 AM
llvm/test/Transforms/SLPVectorizer/AArch64/vector-getelementptr.ll
3

this is missing an AArch64 triple, you need to add something like -mtriple=arm64-apple-ios.

5

Please add a description to the test. The key issue is that it requires a vector GEP + extracts, but the cost is offset by being able to efficiently vectorize the rest of the tree.

44

please don't use null in the test. e.g. loading from null like the test does is UB.

zjaffal updated this revision to Diff 508635.Mar 27 2023, 6:53 AM

rename variables, change ptr from null to function argument and specify the mtriple for opt

zjaffal marked 3 inline comments as done.Mar 27 2023, 6:54 AM
zjaffal added inline comments.
llvm/test/Transforms/SLPVectorizer/AArch64/getelementptr.ll
6 ↗(On Diff #507017)

because -slp-threshold=-7 forces the test to vectorize I guess maybe it modifies the cost model?

fhahn accepted this revision.Mar 27 2023, 8:35 AM

LGTM, thanks. Just a few bits that would be good to address before landing

llvm/test/Transforms/SLPVectorizer/AArch64/vector-getelementptr.ll
4

Move this directly to the test definition, with a newline between comment and run line

6

More consistent to use base3 instead of base_gep? All bases are used with geps

66

It would be more compact to use gep instead of get elementary in the names.

This revision is now accepted and ready to land.Mar 27 2023, 8:35 AM
This revision was automatically updated to reflect the committed changes.