This is an archive of the discontinued LLVM Phabricator instance.

[LV, X86] Be more optimistic about vectorizing shifts.
ClosedPublic

Authored by mkuper on Aug 1 2016, 7:25 PM.

Details

Summary

Shifts with a uniform but non-constant count were considered very expensive to vectorize since rL178703, because the splat would often live in a different block and be invisible to ISel. However, since rL201655, CodeGenPrepare would sink those splats next to their use, so that we can select an appropriate vector shift.

This updates the cost model to reflect the fact we don't need to be so pessimistic anymore.

Diff Detail

Event Timeline

mkuper updated this revision to Diff 66424.Aug 1 2016, 7:25 PM
mkuper retitled this revision from to [LV, X86] Be more optimistic about vectorizing shifts..
mkuper updated this object.
mkuper added reviewers: anemet, wmi, mssimpso, spatel, RKSimon, delena.
mkuper added subscribers: llvm-commits, nadav.
nadav accepted this revision.Aug 1 2016, 9:32 PM
nadav added a reviewer: nadav.

LGTM!

This revision is now accepted and ready to land.Aug 1 2016, 9:32 PM
delena added inline comments.Aug 1 2016, 11:15 PM
lib/Analysis/CostModel.cpp
126

You can use llvm::getSplatValue() here, it does what you need.

mkuper added inline comments.Aug 1 2016, 11:46 PM
lib/Analysis/CostModel.cpp
126

Right, I remembered there had to be a helper for this, but couldn't remember where it was or what it's called. Thanks!

mkuper updated this revision to Diff 66493.Aug 2 2016, 9:57 AM
mkuper edited edge metadata.

Updated to use the correct utility function.
Thanks again, Elena, this has really been bothering me. :)

This revision was automatically updated to reflect the committed changes.