[PATCH] D108138: [SimplifyCFG] Remove switch statements before vectorization

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 06:55:08 PDT 2021


david-arm added a comment.

In D108138#2967100 <https://reviews.llvm.org/D108138#2967100>, @lebedev.ri wrote:

> IMO anything other than enhancing LV is wrong.

Hi @lebedev.ri  I personally disagree here. Adding support to LV for this is significantly more work (and IMO unnecessary) because there are cases when LV has to handle a lot more than just the obvious flattened vectorisation case using vector comparisons and select instructions. We will also need to add support for vectorisation factors of 1 (with interleaving) and cases where VF>1,but we have to scalarise the switch statement. These latter two cases require basically doing exactly the same thing as @kmclaughlin's patch does here, i.e. unswitching the switch statement into compares/branches and new blocks. It seems far simpler to have a small pass that runs prior to the vectoriser (when enabled) that unswitches.

Not sure what others think here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108138



More information about the llvm-commits mailing list