This is an archive of the discontinued LLVM Phabricator instance.

[LoopVectorization] Add an API to make the LoopVectorizer publically accessible
AbandonedPublic

Authored by jmolloy on Sep 14 2015, 8:34 AM.

Details

Summary

There's currently only one way to vectorize a loop - by using the LoopVectorize driver pass. But there's no real reason to have this restriction.

Taking examples from elsewhere in the codebase, I've created an API that takes all its dependencies explicitly and can be called from anywhere in the codebase (subject to layering violations of course).

LoopVectorize turns into a shell wrapper pass, which takes its dependencies from the pass manager and dumbly passes them on to the new LoopVectorization class.

The API makes a distinction between loop vectorization and loop interleaving. Even though these are very conflated within the loop vectorizer, I felt it was important to keep them separate at the API level.

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 34678.Sep 14 2015, 8:34 AM
jmolloy retitled this revision from to [LoopVectorization] Add an API to make the LoopVectorizer publically accessible.
jmolloy updated this object.
jmolloy added reviewers: mzolotukhin, anemet, hfinkel.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: llvm-commits.
jmolloy updated this revision to Diff 34679.Sep 14 2015, 8:36 AM
anemet edited edge metadata.Sep 15 2015, 12:15 PM

Hi James,

Can you please explain the plan here? I am a bit confused how interleaving is now done as part of LoopVectorization::vectorize even though you create a new parallel class LoopInterleaving. What is the plan here?

Besides, I also have some more questions and nitpicks below but probably this first question is the most critical one.

Thanks,
Adam

I am assuming this is NFC. Please mention that for each patch.

Do you have plans to move out the implementation to its own module? If not immediately, you may want to explain the difficulty in the header or somewhere.

include/llvm/Transforms/Utils/LoopWidening.h
60

s/Add/add

lib/Transforms/Vectorize/LoopVectorize.cpp
1609–1611

This does not look like properly clang-formatted

1614–1618

I think it's probably better to only add these arguments when they become supported.

jmolloy abandoned this revision.Sep 20 2015, 5:20 PM