On Thu, 14 Nov 2019 10:41:25 +0100 Martin Liška <mli...@suse.cz> wrote:
> On 11/6/19 10:02 PM, Bernhard Reutner-Fischer wrote: > > Also why do you punt on duplicate conditions like in > > > >> +++ b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-4.c > >> +int main(int argc, char **argv) > >> +{ > >> + if (argc == 1) > >> + else if (argc == 2) > >> + else if (argc == 3) > >> + else if (argc == 4) > >> + else if (argc == 1) > >> + { > > This block is dead, isn't it. Why don't you just discard it but punt? > > > > Hello. > > After I moved the pass later in optimization pipeline, such dead conditions nice > are already gone. What's remaining are situations like: > > if (argc >= 1 && argc <= 10) > ... > else if (argc >= 8 && argc <= 15) > > which are overlapping intervals. I'm not planning to handle these in the first > iteration of the patch. yea. Later when we see a new interval overlapping old, we can adjust the new to clamp to the intersection of old and new. We'd need to generate one or more artificial intervals covering the delta interval with the body of new if we find intervening previous intervals, which complicates things more than a first attempt of a patch should supposedly do, agree. One step at a time :) thanks for moving it later in the pipeline! cheers,