aboutsummaryrefslogtreecommitdiff
path: root/gcc/dce.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-11-12 20:21:59 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-11-12 20:21:59 +0000
commit211d71a745167d6bb935ddf21b7d7f6dd5168969 (patch)
treee07507a7438788aa1e87722aa4308905bc85b8d3 /gcc/dce.c
parent06b1198f7584b1e1cec68f96b9525629d6beeab0 (diff)
downloadgcc-211d71a745167d6bb935ddf21b7d7f6dd5168969.zip
gcc-211d71a745167d6bb935ddf21b7d7f6dd5168969.tar.gz
gcc-211d71a745167d6bb935ddf21b7d7f6dd5168969.tar.bz2
re PR rtl-optimization/51447 (global register variable definition incorrectly removed as dead code)
gcc/ PR rtl-optimization/51447 * df-scan.c (df_get_entry_block_def_set): Add global regs to the set. * df-problems.c (df_lr_local_compute): Make global regs always live. * dce.c (deletable_insn_p): Make insns setting a global reg inherently necessary. testsuite/ PR rtl-optimization/51447 * gcc.c-torture/execute/pr51447.c: New test. From-SVN: r193453
Diffstat (limited to 'gcc/dce.c')
-rw-r--r--gcc/dce.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/dce.c b/gcc/dce.c
index 9a87677..7e4adda 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -121,6 +121,12 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores)
&& !insn_nothrow_p (insn))
return false;
+ /* If INSN sets a global_reg, leave it untouched. */
+ for (df_ref *def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+ if (HARD_REGISTER_NUM_P (DF_REF_REGNO (*def_rec))
+ && global_regs[DF_REF_REGNO (*def_rec)])
+ return false;
+
body = PATTERN (insn);
switch (GET_CODE (body))
{