This is an archive of the discontinued LLVM Phabricator instance.

LoopVectorize: teach loop vectorizer to vectorize calls.
ClosedPublic

Authored by mzolotukhin on Mar 5 2015, 7:54 PM.

Details

Summary

LoopVectorize: teach loop vectorizer to vectorize calls.

This is the fourth of 6 patches for enabling vectorization of calls.

Diff Detail

Event Timeline

mzolotukhin updated this revision to Diff 21326.Mar 5 2015, 7:54 PM
mzolotukhin retitled this revision from to LoopVectorize: teach loop vectorizer to vectorize calls..
mzolotukhin updated this object.
mzolotukhin edited the test plan for this revision. (Show Details)
mzolotukhin added a subscriber: Unknown Object (MLST).
hfinkel added inline comments.Mar 5 2015, 8:47 PM
lib/Analysis/LoopAccessAnalysis.cpp
967

You also need to check for !Call->isNoBuiltin() when not an intrinsic.

mzolotukhin updated this revision to Diff 21403.Mar 6 2015, 3:00 PM
  • Address Hal's remark: check call for not being a builtin.
hfinkel added inline comments.Mar 8 2015, 2:49 PM
lib/Transforms/Vectorize/LoopVectorize.cpp
3334

Please make sure these functions have the right readonly/readnone attributes (we should take them from the function being vectorized I think). Maybe just copy all of the attributes?

mzolotukhin updated this revision to Diff 21543.Mar 9 2015, 7:57 PM
  • When creating a vector function copy attributes from the original scalar function.
  • Estimate cost of call scalarization inside the vectorizer.
hfinkel added inline comments.Mar 11 2015, 12:25 AM
lib/Transforms/Vectorize/LoopVectorize.cpp
2645

Do this before computing RetTy and Tys. Then, if VF == 1, set the necessary variables and return. Otherwise, continue, but you'll know that the types are vector types, so you can commit the calls to isVectorTy(). There is no need to compute the cost twice for VF == 1.

2671

These types won't match those in F's declaration; please pass nullptr for F.

  • Simplify getVectorCallCost.
  • Add a check for nobuiltin attribute.
hfinkel accepted this revision.Mar 16 2015, 10:52 PM
hfinkel edited edge metadata.

LGTM. When you commit, please note that the test cases are added with the TLI commit for D8131.

This revision is now accepted and ready to land.Mar 16 2015, 10:52 PM
mzolotukhin edited edge metadata.
  • Don't pass TLI argument to getCallInstrCost.
mzolotukhin closed this revision.Mar 17 2015, 12:53 PM

Thanks, committed in r232530!