[vectorizer] Teach the loop vectorizer's unroller to only unroll by

Press ? to show keyboard shortcuts.
Committed
chandlercJan 27 2014, 3:12 AM
Parents
rL200212: [vectorizer] Add some flags which are useful for conducting experiments
Branches
Unknown
Tags
Unknown
Subscribers
None
Description

[vectorizer] Teach the loop vectorizer's unroller to only unroll by
powers of two. This is essentially always the correct thing given the
impact on alignment, scaling factors that can be used in addressing
modes, etc. Also, fix the management of the unroll vs. small loop cost
to more accurately model things with this world.

Enhance a test case to actually exercise more of the unroll machinery if
using synthetic constants rather than a specific target model. Before
this change, with the added flags this test will unroll 3 times instead
of either 2 or 4 (the two sensible answers).

While I don't expect this to make a huge difference, if there are lots
of loops sitting right on the edge of hitting the 'small unroll' factor,
they might change behavior. However, I've benchmarked moving the small
loop cost up and down in many various ways and by a huge factor (2x)
without seeing more than 0.2% code size growth. Small adjustments such
as the series that led up here have led to about 1% improvement on some
benchmarks, but it is very close to the noise floor so I mostly checked
that nothing regressed. Let me know if you see bad behavior on other
targets but I don't expect this to be a sufficiently dramatic change to
trigger anything.

rL200213

llvm/trunk/include/llvm/Support/MathExtras.h

Loading...

llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Loading...

llvm/trunk/test/Transforms/LoopVectorize/unroll_novec.ll

Loading...

Add Comment