Page MenuHomePhabricator

Add -mprefer-vector-width driver option and attribute during CodeGen.

Authored by craig.topper on Nov 19 2017, 2:53 PM.



This adds a new command line option -mprefer-vector-width to specify a preferred vector width for the vectorizers. Valid values are 'none' and unsigned integers. The driver will check that it meets those constraints. Specific supported integers will be managed by the targets in the backend.

Clang will take the value and add it as a new function attribute during CodeGen.

This represents the alternate direction proposed by Sanjay in this RFC:

This supercedes D39576.

Diff Detail


Event Timeline

craig.topper created this revision.Nov 19 2017, 2:53 PM
craig.topper edited the summary of this revision. (Show Details)Nov 19 2017, 2:54 PM
spatel added inline comments.
254 ↗(On Diff #123518)

typo - 'preferred'. Should add a bit more to the explanation. "The preferred width for auto-vectorization transforms. This is intended to override default transforms based on the width of the architected vector registers." ?

277 ↗(On Diff #123518)

Comment got chopped off? Should we also include an explanation in the clang manual?

285–286 ↗(On Diff #123518)

What is the intended functionality when specifying 'none'? If it's equivalent to passing "-vectorize-slp" + "-vectorize-loops", can we use the existing flags?

Address comments.

The value of 'none' is intended to cancel out any other option specified. I've changed it so that we no longer pass 'none' to llvm and instead suppress the attribute.

Still pass the attribute the backend if the value is 'none'.

We actually need this to know if the user specified the command line option at all. The value of 'none' should disable limits and prevents needing to pick a specific value.

spatel accepted this revision.Nov 27 2017, 6:09 AM


This revision is now accepted and ready to land.Nov 27 2017, 6:09 AM
This revision was automatically updated to reflect the committed changes.