[Bug rtl-optimization/51447] [4.6/4.7/4.8 Regression] global register variable definition incorrectly removed as dead code
steven at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Nov 11 22:05:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447
--- Comment #12 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-11 22:05:37 UTC ---
(In reply to comment #7)
> Created attachment 26100 [details]
> gcc47-pr51447.patch
>
> While that fixes the testcase at -O1, at -O2 and above it still fails.
> Apparently ud_dce pass removes it.
I think DCE should never delete an insn setting a global reg. So in
addition to your patch, we'd need the following patch:
Index: dce.c
===================================================================
--- dce.c (revision 193411)
+++ dce.c (working copy)
@@ -98,6 +98,11 @@ deletable_insn_p (rtx insn, bool fast, b
rtx body, x;
int i;
+ /* If INSN sets a global_reg, leave it untouched. */
+ for (df_ref *def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+ if (global_regs[DF_REF_REGNO (*def_rec)])
+ return false;
+
if (CALL_P (insn)
/* We cannot delete calls inside of the recursive dce because
this may cause basic blocks to be deleted and this messes up
More information about the Gcc-bugs
mailing list