[PATCH] D47267: [UnrollAndJam] Add unroll_and_jam pragma handling

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 12:02:09 PDT 2018


Meinersbur added a comment.

In https://reviews.llvm.org/D47267#1109912, @dmgreen wrote:

> > Could we maybe disable the #pragma clang loop unroll_and_jam spelling ftm to avoid compatibility issues?
>
> Sure, I'm not against. It sounds like you have opinions on how this should work. That's good. If there are multiple clang loop pragma's, what is the expected behaviour there?
>
> In the llvm side of this, in the unroll and jam pass, I made it so that a loop with "llvm.loop.unroll" metadata without any "llvm.loop.unroll_and_jam" metadata will not do unroll and jam, it will leave the loop for the unroller. On the expectation that the use really wants to unroll (and it applies to llvm.loop.unroll.disable too, disabling unroll and jam as well as unroll). I haven't done anything with other loop metadata though.


I'd expect that transformations "stack up". E.g.

  #pragma unroll_and_jam
  #pragma unroll(4)

which I'd expect to unroll by a factor of 4 first, then try to unroll-and-jam (which I am not sure https://reviews.llvm.org/D41953 can do due to then containing 4 loops). On the other hand

  #pragma unroll(4)
  #pragma unroll_and_jam

should unroll-and-jam, and then unroll the outer loop by a factor of 4.


https://reviews.llvm.org/D47267





More information about the cfe-commits mailing list