This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnrollRuntime] Avoid high-cost trip count computation.
ClosedPublic

Authored by sanjoy on Apr 12 2015, 12:00 AM.

Details

Summary

Runtime unrolling of loops needs to emit an expression to compute the
loop's runtime trip-count. Avoid runtime unrolling if this computation
will be expensive.

Depends on D8993.

Diff Detail

Repository
rL LLVM

Event Timeline

sanjoy updated this revision to Diff 23654.Apr 12 2015, 12:00 AM
sanjoy retitled this revision from to [LoopUnrollRuntime] Avoid high-cost trip count computation..
sanjoy updated this object.
sanjoy edited the test plan for this revision. (Show Details)
sanjoy added a reviewer: atrick.
sanjoy added a subscriber: Unknown Object (MLST).
hfinkel requested changes to this revision.Apr 12 2015, 5:24 AM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

You'll need to add a field in the UnrollingPreferences structure to control this. The makes a lot of sense on X86, where we only unroll small loops to fill the LSD's dispatch buffer (and they're still pretty small even after unrolling). On other targets we unroll to much larger sizes and the cost of a division is amortized over many more instructions and iterations.

This revision now requires changes to proceed.Apr 12 2015, 5:24 AM
sanjoy updated this revision to Diff 23659.Apr 12 2015, 1:45 PM
sanjoy edited edge metadata.

I've added AllowExpensiveTripCount to UnrollPreferences. I don't
have a good understanding for when AllowExpensiveTripCount should be
true, so I've left it false always.

  • address Hal's review: add UP.AllowExpensiveTripCount, off by default
atrick accepted this revision.Apr 13 2015, 1:19 AM
atrick edited edge metadata.

LGTM

This revision was automatically updated to reflect the committed changes.