[LV, X86] Be more optimistic about vectorizing shifts.
authorMichael Kuperstein <mkuper@google.com>
Thu, 4 Aug 2016 22:48:03 +0000 (22:48 +0000)
committerMichael Kuperstein <mkuper@google.com>
Thu, 4 Aug 2016 22:48:03 +0000 (22:48 +0000)
commit3ceac2bbd5e48a3e7d90b7344d45d9f7cf3106a5
tree6ae8ac6b6ffc55fa5e76436031397a45b035ca96
parent742c38361bfcf53561c0fca9289abbda03a5f40b
[LV, X86] Be more optimistic about vectorizing shifts.

Shifts with a uniform but non-constant count were considered very expensive to
vectorize, because the splat of the uniform count and the shift would tend to
appear in different blocks. That made the splat invisible to ISel, and we'd
scalarize the shift at codegen time.

Since r201655, CodeGenPrepare sinks those splats to be next to their use, and we
are able to select the appropriate vector shifts. This updates the cost model to
to take this into account by making shifts by a uniform cheap again.

Differential Revision: https://reviews.llvm.org/D23049

llvm-svn: 277782
llvm/lib/Analysis/CostModel.cpp
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Analysis/CostModel/X86/uniformshift.ll [new file with mode: 0644]
llvm/test/Transforms/LoopVectorize/X86/uniformshift.ll [new file with mode: 0644]