On 11/14/19 1:15 PM, Richard Biener wrote:
Hmm. I was thinking of moving the pass instead of adding another one. What's the reason to run switch-conversion during early optimization again?
I'm adding CC, as he's the author of cswitch pass and he probably knows more about the pass placement. But I bet early conversion to array access rapidly simplifies CFG and other passes can benefit from that.
But then it's probably not too bad... (and somehow I'd still like to see switch-conversion, switch lowering and if-to-switch be "integrated" somehow, analyzing the IL and then outputting optimized if/switch according to the same cost metric).
Well, my intuition is that gswitch statement is a canonical representation of a switch. And so that one wants to have if-to-switch early in the pipeline and switch lowering very late? Martin