http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47525
Peter Bergner <bergner at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |powerpc64-linux CC| |meissner at gcc dot gnu.org Known to work| |4.3.0 Host| |powerpc64-linux Known to fail| |4.4.0, 4.5.0, 4.6.0 Build| |powerpc64-linux --- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> 2011-01-28 22:46:09 UTC --- I tracked this down to -maltivec triggers code in rs6000.c:rs6000_conditional_register_usage() that forces VSCR_REGNO to be marked as a global register: if (TARGET_ALTIVEC || TARGET_VSX) global_regs[VSCR_REGNO] = 1; Then this code in df-scan.c:df_get_call_refs() forces all global registers to be added to every function call's use and def chains, since they "might" be referenced by the call: /* Calls may also reference any of the global registers, so they are recorded as used. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (global_regs[i]) { df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i], NULL, bb, insn_info, DF_REF_REG_USE, flags); df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i], NULL, bb, insn_info, DF_REF_REG_DEF, flags); } The global register in the calls use and def chains are what stops DCE from eliminating the call. The bug is that const functions won't read or write any global registers and pure functions won't write them. The "fix" is to skip this code entirely for calls to const functions and skip the addition to the def chain for calls to pure functions. A bootstrap and regtesting of a fix are in progress.