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

2021-08-26 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. >> I had a look at the LowerSwitch pass as suggested by @junparser, and I did >> find that running it before vectorisation transforms the switch and allows >> the same loops to be vectorised. However, I did find that if the loop is not >> vectorised then the switch is

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

2021-08-26 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. >> I could try to change LowerSwitch to create branches which SimplifyCFG will >> be able to recognise and replace with a switch, or try to change SimplifyCFG >> to recognise this pattern of compares & branches. 2. option is better. Repository: rG LLVM Github Mon

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

2021-08-26 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In D108138#2967156 , @david-arm wrote: > In D108138#2967133 , @lebedev.ri > wrote: > >> How is it conceptually different to break apart IR in LV itself, or do the >> same in a special

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

2021-08-26 Thread David Sherwood via Phabricator via cfe-commits
david-arm added a comment. In D108138#2967133 , @lebedev.ri wrote: > How is it conceptually different to break apart IR in LV itself, or do the > same in a special pass just before that? > If we want to go this road, we need to completely make `switch`e

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

2021-08-26 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. How is it conceptually different to break apart IR in LV itself, or do the same in a special pass just before that? If we want to go this road, we need to completely make `switch`es illegal/non-canonical before LV. Repository: rG LLVM Github Monorepo CHANGES SINC

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

2021-08-26 Thread David Sherwood via Phabricator via cfe-commits
david-arm added a comment. In 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

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

2021-08-26 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. IMO anything other than enhancing LV is wrong. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108138/new/ https://reviews.llvm.org/D108138 ___ cfe-commits mailing list cfe-comm

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

2021-08-26 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin added a comment. Thanks all for the suggestions on this patch :) I had a look at the LowerSwitch pass as suggested by @junparser, and I did find that running it before vectorisation transforms the switch and allows the same loops to be vectorised. However, I did find that if the loo

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

2021-08-17 Thread JunMa via Phabricator via cfe-commits
junparser added a comment. Since we already have LowerSwitchPass to transform switchinst, can we add a cost modle and run it before vectorization? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108138/new/ https://reviews.llvm.org/D108138

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

2021-08-17 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added subscribers: nikic, xbolva00. xbolva00 added a comment. Also check @nikic’s https://reviews.llvm.org/D95296 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108138/new/ https://reviews.llvm.org/D108138 _

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

2021-08-17 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment. In D108138#2948995 , @david-arm wrote: > In D108138#2948975 , @dmgreen wrote: > >>> I'm under the impression that the vectoriser has a policy of never making >>> scalar transformations >>

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

2021-08-17 Thread David Sherwood via Phabricator via cfe-commits
david-arm added a comment. In D108138#2948975 , @dmgreen wrote: >> I'm under the impression that the vectoriser has a policy of never making >> scalar transformations > > I'm not sure what you mean. I've not looked into the details, but it could > presu

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

2021-08-17 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment. > I'm under the impression that the vectoriser has a policy of never making > scalar transformations I'm not sure what you mean. I've not looked into the details, but it could presumably be done as some sort of VPlan transformation, possibly in the constructions of vpl

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

2021-08-17 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. The alternative to teaching looprotate/LV about switches is to make swiches non-canonical in the first half of the pipeline, before LV. That is, don't form them, and aggressively expand any and all existing switches. Repository: rG LLVM Github Monorepo CHANGES SIN

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

2021-08-17 Thread David Sherwood via Phabricator via cfe-commits
david-arm added a comment. In D108138#2947229 , @lebedev.ri wrote: > I'm not sure i'm sold on this, even though i'm aware that selects hurt > vectorization. > How does this Simplify the CFG? I think it would be best to teach LV selects, > or at worst do

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

2021-08-16 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. I'm not sure i'm sold on this, even though i'm aware that selects hurt vectorization. How does this Simplify the CFG? I think it would be best to teach LV selects, or at worst do this in LV itself. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION ht

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

2021-08-16 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin created this revision. kmclaughlin added reviewers: david-arm, fhahn, dmgreen, craig.topper, lebedev.ri. Herald added subscribers: ctetreau, ormris, wenlei, steven_wu, hiraditya, kristof.beyls. kmclaughlin requested review of this revision. Herald added projects: clang, LLVM. Herald a