aboutsummaryrefslogtreecommitdiff
path: root/gcc/df-scan.c
diff options
context:
space:
mode:
authorPeter Bergner <bergner@vnet.ibm.com>2011-02-02 14:08:06 -0600
committerPeter Bergner <bergner@gcc.gnu.org>2011-02-02 14:08:06 -0600
commit9cd4f22a4519538f2feffa8997ac309d5dcd54b7 (patch)
tree2a6c8c9833162d25bb4977072dccdd2ac9b0af48 /gcc/df-scan.c
parent8e2bc95be59aa82767921fe0b83e0da93caaa611 (diff)
downloadgcc-9cd4f22a4519538f2feffa8997ac309d5dcd54b7.zip
gcc-9cd4f22a4519538f2feffa8997ac309d5dcd54b7.tar.gz
gcc-9cd4f22a4519538f2feffa8997ac309d5dcd54b7.tar.bz2
re PR rtl-optimization/47525 (DCE fails to eliminate a dead call to a pure function when compiled with -maltivec)
PR rtl-optimization/47525 * df-scan.c: Update copyright years. (df_get_call_refs): Do not mark global registers as DF_REF_REG_USE and non-clobber DF_REF_REG_DEF for calls to const and pure functions. From-SVN: r169768
Diffstat (limited to 'gcc/df-scan.c')
-rw-r--r--gcc/df-scan.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 1400d25..42b4b14 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -1,6 +1,6 @@
/* Scanning of rtl for dataflow analysis.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010 Free Software Foundation, Inc.
+ 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Originally contributed by Michael P. Hayes
(m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
@@ -3360,16 +3360,19 @@ df_get_call_refs (struct df_collection_rec * collection_rec,
NULL, bb, insn_info, DF_REF_REG_USE,
DF_REF_CALL_STACK_USAGE | flags);
- /* 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);
- }
+ /* Calls to const functions cannot access any global registers and calls to
+ pure functions cannot set them. All other calls may reference any of the
+ global registers, so they are recorded as used. */
+ if (!RTL_CONST_CALL_P (insn_info->insn))
+ 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);
+ if (!RTL_PURE_CALL_P (insn_info->insn))
+ df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
+ NULL, bb, insn_info, DF_REF_REG_DEF, flags);
+ }
is_sibling_call = SIBLING_CALL_P (insn_info->insn);
EXECUTE_IF_SET_IN_BITMAP (regs_invalidated_by_call_regset, 0, ui, bi)