This is an archive of the discontinued LLVM Phabricator instance.

Remove unroll pragma metadata after it is used
ClosedPublic

Authored by meheff on Jul 17 2014, 1:37 PM.

Details

Reviewers
eliben
Summary

This change causes the loop unroller to remove unroll pragma metadata after it is used. This prevents a loop from being unrolled more than is directed by a pragma if the loop
unrolling pass is run more than once which it generally is.

Diff Detail

Event Timeline

meheff updated this revision to Diff 11610.Jul 17 2014, 1:37 PM
meheff retitled this revision from to Remove unroll pragma metadata after it is used.
meheff updated this object.
meheff edited the test plan for this revision. (Show Details)
meheff added a reviewer: eliben.
meheff added a subscriber: Unknown Object (MLST).
hfinkel added inline comments.
lib/Transforms/Scalar/LoopUnrollPass.cpp
286

I suppose this 1 Value* is a placeholder for the self-reference loop-id. Should comment. Also, you expect this to be nullptr, right? You should explicit specify that so it is clear.

301

This does not seem to match the language reference, which says "Note that setting llvm.loop.vectorize.unroll to 1 disables unrolling of the loop." -- Is that out of date?

Thanks for the comments. I'll immediately follow this with the updated patch.

lib/Transforms/Scalar/LoopUnrollPass.cpp
286

Added a comment, and slightly changed the code so it is less surprising.

301

"llvm.loop.vectorize.unroll" is for the vectorizer unroller (interleaver), this is the concatenation loop unroller which uses "llvm.loop.unroll.*". For the concatenation unroller, setting "llvm.loop.unroll.enable" to 0 disables unrolling.

And now I see that "llvm.loop.unroll.*" metadata needs an entry in LangRef.rst and the bit about "llvm.loop.vectorize.unroll" should be changed to match the terminology in LanguageExtensions.rst (use "interleave" instead of "unroll" to avoid confusing it with the loop unroller). I'll fix this in a follow up change.

meheff updated this revision to Diff 11613.Jul 17 2014, 3:13 PM
eliben accepted this revision.Jul 18 2014, 1:54 PM
eliben edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 18 2014, 1:54 PM

Committed with r213412.

Mark

meheff closed this revision.Apr 16 2015, 10:25 AM