Hi Martin,
On Tue, 28 May 2019 at 13:30, Martin Liška <mli...@suse.cz> wrote: > > On 5/27/19 2:50 PM, Jakub Jelinek wrote: > > On Mon, May 27, 2019 at 02:18:37PM +0200, Martin Liška wrote: > >> +/* Compare loop information for basic blocks BB1 and BB2. */ > >> + > >> +bool > >> +func_checker::compare_loops (basic_block bb1, basic_block bb2) > >> +{ > >> + if ((bb1->loop_father == NULL) != (bb2->loop_father == NULL)) > >> + return return_false (); > >> + > >> + struct loop *l1 = bb1->loop_father; > >> + struct loop *l2 = bb2->loop_father; > > > > Perhaps also > > if ((bb1 == l1->header) != (bb2 == l2->header)) > > return return_false_with_msg ("header"); > > if ((bb1 == l1->latch) != (bb2 == l2->latch)) > > return return_false_with_msg ("latch"); > > too? > > Yes, makes sense. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > The new testcase contains: /* { dg-do compile } */ /* { dg-options "-fopenmp-simd -O2 -mavx512f -fdump-ipa-icf" } */ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ I suspect line 3 should actually be line 1, because the test fails to compile on non-x86 targets: xgcc: error: unrecognized command line option '-mavx512f' Was it your intention? Thanks, Christophe > > > > BTW, unrelated to this patch, what does ICF do if e.g. SSA_NAME_PTR_INFO > > or SSA_NAME_RANGE_INFO is different between otherwise identical functions? > > Say one having early > > if (arg > 10) > > __builtin_unreachable (); > > and another one > > if (arg > - 10) > > __builtin_unreachable (); > > both optimized away into SSA_NAME_RANGE_INFO of the argument before IPA (or > > do we optimize that away only after IPA?). > > > > Jakub > > > > Can you please provide a self-contained test-case? > > Thanks, > Martin