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.
Details
- Reviewers
eliben
Diff Detail
Event Timeline
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. |
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.