[PATCH] D102748: [LoopUnroll] Don't unroll before vectorisation

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 19 01:49:46 PDT 2021


nikic added a comment.

@SjoerdMeijer I expect you will find some test cases when you update phase ordering tests. A typical pattern is that a loop is working on a local array, gets fully unrolled, the array gets SROAd into individual array elements, mem2reg'd and then folds down to something much more efficient -- as if you didn't have a loop in the first place, and wrote out the unrolled code.

I occasionally see optimization failures in Rust which are caused by failure to fully unroll a loop at this pipeline position (because of weaknesses in unrolling). If the loop only gets unrolled in the late optimization pipeline, then that usually leaves behind "trivially optimizable" code. In some cases DAGCombine manages to pick up the slack (modulo dead stack allocations), but that's certainly not how it should work.

I don't have suggestion on how to move forward *this* patch, because I think it's fundamentally the wrong direction to take.

> As somewhat related data point, i'm currently looking at a case where we completely unroll a loop that should have been later recognized by LoopIdiom pass.

LoopIdiom runs before full unrolling, so that seems odd?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102748/new/

https://reviews.llvm.org/D102748



More information about the llvm-commits mailing list