expand: Throw away non-external decls without varpool nodes [PR105415]
The following testcase fails -fcompare-debug on aarch64-linux. The problem is that for the n variable we create a varpool node, then remove it again because the var isn't really used, but it keeps being referenced in debug stmts/insns with -g. Later during sched1 pass we ask whether the n var can be modified through some store to an anchored variable and with -g we create a new varpool node for it again just so that we can find its ultimate alias target. Even later on we create some cgraph node for the loop parallelization, but as there has been an extra varpool node creation in between, we get higher node->order with -g than without. The patch fixes that by throwing variables without varpool nodes away during expansion time, they are very unlikely to actually end up with useful debug info anyway. I've bootstrapped/regtested the following on x86_64-linux and i686-linux, then bootstrapped with the patch reverted, reapplied the patch and did make cc1plus in stage3. The debug section sizes are identical, .debug_info and .debug_loc is identical too, so I think we don't lose any debug info through it. So at least on cc1plus it makes no difference. 2022-05-02 Jakub Jelinek <jakub@redhat.com> PR debug/105415 * cfgexpand.cc (expand_debug_expr): Don't make_decl_rtl_for_debug if there is no symtab node for the VAR_DECL. * gcc.dg/pr105415.c: New test.
Loading
Please register or sign in to comment