This is an archive of the discontinued LLVM Phabricator instance.

[Attr][Doc] Fix pragma unroll documentation.
ClosedPublic

Authored by bader on Oct 18 2022, 4:54 AM.

Details

Summary

There is a contradiction in the #pragma unroll behavior documentation.
It says that specifying #pragma unroll without a parameter directs the
loop unroller to attempt to partially unroll the loop if the trip count
is not known at compile time. At the same time later it states that
#pragma unroll has identical semantics to #pragma clang loop unroll(full),
which doesn't attempt to unroll partially if the trip count is not known
at compile time.

pragma clang loop unroll(enable):
If unroll(enable) is specified the unroller will attempt to fully unroll
the loop if the trip count is known at compile time. If the fully
unrolled code size is greater than an internal limit the loop will be
partially unrolled up to this limit. If the trip count is not known at
compile time the loop will be partially unrolled with a heuristically
chosen unroll factor.

pragma clang loop unroll(full):
If unroll(full) is specified the unroller will attempt to fully unroll
the loop if the trip count is known at compile time identically to
unroll(enable). However, with unroll(full) the loop will not be unrolled
if the loop count is not known at compile time.

Diff Detail

Event Timeline

bader created this revision.Oct 18 2022, 4:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 4:54 AM
Herald added a subscriber: ebevhan. · View Herald Transcript
bader requested review of this revision.Oct 18 2022, 4:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 4:54 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
bader updated this revision to Diff 468487.Oct 18 2022, 4:57 AM

Update commit message.

bader edited the summary of this revision. (Show Details)Oct 18 2022, 4:57 AM
aaron.ballman accepted this revision.Oct 18 2022, 10:35 AM

LGTM, thank you for the fix!

This revision is now accepted and ready to land.Oct 18 2022, 10:35 AM
This revision was automatically updated to reflect the committed changes.