I'm adding loop unrolling pragmas to clang with change (not yet submitted): http://reviews.llvm.org/D4089
This optimizer change consumes the metadata produced from those pragmas and uses them in the loop unroller.
The pragmas must immediately precede a loop statement and take the following forms:
#pragma clang loop unroll(enable) unroll the loop completely
#pragma clang loop unroll(disable) do not unroll the loop.
#pragma clang loop unroll_count(N) // unroll the loop N times
These pragmas mirror recently added loop vectorizer pragmas. If you have comments on the particulars of the syntax and semantics please comment on the clang change.
a) I would choose a slightly higher value. The reason for the limit is mostly to avoid absolutely insane behaviour. i.e. 100k might be a good one
b) Does the frontend enforce any type of limit?
c) Might be worth making this an command line option
None of these are must change, use your judgement.