aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-03-06 10:31:41 +0000
committerJakub Jelinek <jakub@redhat.com>2012-03-06 10:31:41 +0000
commit9e0d1304ec7979253fc31b39a87c90511eae4aba (patch)
treee398b108c1b98be81e8a334ae2c5d57c87c2426d
parentaf1aebe564973caa9c2e03f1d7fb166d6a231091 (diff)
svn merge -r184125:184126 svn+ssh://gcc.gnu.org/svn/gcc/trunk
svn merge -r184041:184042 svn+ssh://gcc.gnu.org/svn/gcc/trunk svn merge -r183970:183971 svn+ssh://gcc.gnu.org/svn/gcc/trunk svn merge -r182844:182845 svn+ssh://gcc.gnu.org/svn/gcc/trunk svn merge -r182760:182761 svn+ssh://gcc.gnu.org/svn/gcc/trunk git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_6-branch@184984 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog37
-rw-r--r--gcc/dwarf2out.c23
-rw-r--r--gcc/gcc.c53
-rw-r--r--gcc/reg-stack.c8
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gcc.dg/pr51683.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr52132.c18
-rw-r--r--gcc/tree-ssa-ccp.c8
-rw-r--r--gcc/tree-ssa-propagate.c6
-rw-r--r--gcc/var-tracking.c9
10 files changed, 142 insertions, 48 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5cce8f04f70..4cabc79b8f9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,40 @@
+2012-02-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/52132
+ * reg-stack.c (subst_stack_regs_in_debug_insn): Don't use
+ get_true_reg.
+
+2012-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/52165
+ * var-tracking.c (emit_note_insn_var_location): If
+ EMIT_NOTE_BEFORE_INSN and insn is NOTE_INSN_CALL_ARG_LOCATION,
+ emit it before next non-NOTE_INSN_CALL_ARG_LOCATION
+ non-NOTE_DURING_CALL_P insn.
+
+2012-02-07 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c (main): Don't look for lto-wrapper or lto-wrapper
+ or LTOPLUGINSONAME if have_c.
+
+2012-01-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR pch/51722
+ * dwarf2out.c (dwarf2out_start_source_file, dwarf2out_define,
+ dwarf2out_undef): Allocate e.info using ggc_strdup instead
+ of xstrdup.
+ (output_macinfo_op): Don't ggc_strdup fd->filename.
+ (optimize_macinfo_range): Allocate grp_name using XALLOCAVEC,
+ then ggc_strdup it. Don't free inc->info or cur->info.
+ (output_macinfo): Don't free ref->info or file->info.
+
+2012-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51683
+ * tree-ssa-propagate.c (substitute_and_fold): Don't optimize away
+ calls with side-effects.
+ * tree-ssa-ccp.c (ccp_fold_stmt): Likewise.
+
2012-03-04 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Backport from mainline
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9398cb2323c..ad51eb77c7f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -23607,7 +23607,7 @@ dwarf2out_start_source_file (unsigned int lineno, const char *filename)
macinfo_entry e;
e.code = DW_MACINFO_start_file;
e.lineno = lineno;
- e.info = xstrdup (filename);
+ e.info = ggc_strdup (filename);
VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
}
}
@@ -23653,7 +23653,7 @@ dwarf2out_define (unsigned int lineno ATTRIBUTE_UNUSED,
}
e.code = DW_MACINFO_define;
e.lineno = lineno;
- e.info = xstrdup (buffer);;
+ e.info = ggc_strdup (buffer);
VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
}
}
@@ -23680,7 +23680,7 @@ dwarf2out_undef (unsigned int lineno ATTRIBUTE_UNUSED,
}
e.code = DW_MACINFO_undef;
e.lineno = lineno;
- e.info = xstrdup (buffer);
+ e.info = ggc_strdup (buffer);
VEC_safe_push (macinfo_entry, gc, macinfo_table, &e);
}
}
@@ -23720,8 +23720,6 @@ output_macinfo_op (macinfo_entry *ref)
{
case DW_MACINFO_start_file:
fd = lookup_filename (ref->info);
- if (fd->filename == ref->info)
- fd->filename = ggc_strdup (fd->filename);
file_num = maybe_emit_file (fd);
dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file");
dw2_asm_output_data_uleb128 (ref->lineno,
@@ -23860,8 +23858,8 @@ optimize_macinfo_range (unsigned int idx, VEC (macinfo_entry, gc) *files,
linebuf_len = strlen (linebuf);
/* The group name format is: wmN.[<encoded filename>.]<lineno>.<md5sum> */
- grp_name = XNEWVEC (char, 4 + encoded_filename_len + linebuf_len + 1
- + 16 * 2 + 1);
+ grp_name = XALLOCAVEC (char, 4 + encoded_filename_len + linebuf_len + 1
+ + 16 * 2 + 1);
memcpy (grp_name, DWARF_OFFSET_SIZE == 4 ? "wm4." : "wm8.", 4);
tail = grp_name + 4;
if (encoded_filename_len)
@@ -23882,14 +23880,13 @@ optimize_macinfo_range (unsigned int idx, VEC (macinfo_entry, gc) *files,
inc = VEC_index (macinfo_entry, macinfo_table, idx - 1);
inc->code = DW_MACRO_GNU_transparent_include;
inc->lineno = 0;
- inc->info = grp_name;
+ inc->info = ggc_strdup (grp_name);
if (*macinfo_htab == NULL)
*macinfo_htab = htab_create (10, htab_macinfo_hash, htab_macinfo_eq, NULL);
/* Avoid emitting duplicates. */
slot = htab_find_slot (*macinfo_htab, inc, INSERT);
if (*slot != NULL)
{
- free (CONST_CAST (char *, inc->info));
inc->code = 0;
inc->info = NULL;
/* If such an entry has been used before, just emit
@@ -23904,7 +23901,6 @@ optimize_macinfo_range (unsigned int idx, VEC (macinfo_entry, gc) *files,
i++)
{
cur->code = 0;
- free (CONST_CAST (char *, cur->info));
cur->info = NULL;
}
}
@@ -23967,7 +23963,6 @@ output_macinfo (void)
if (!VEC_empty (macinfo_entry, files))
{
macinfo_entry *file = VEC_last (macinfo_entry, files);
- free (CONST_CAST (char *, file->info));
VEC_pop (macinfo_entry, files);
}
break;
@@ -23997,10 +23992,6 @@ output_macinfo (void)
break;
}
output_macinfo_op (ref);
- /* For DW_MACINFO_start_file ref->info has been copied into files
- vector. */
- if (ref->code != DW_MACINFO_start_file)
- free (CONST_CAST (char *, ref->info));
ref->info = NULL;
ref->code = 0;
}
@@ -24034,7 +24025,6 @@ output_macinfo (void)
ref->lineno);
ASM_OUTPUT_LABEL (asm_out_file, label);
ref->code = 0;
- free (CONST_CAST (char *, ref->info));
ref->info = NULL;
dw2_asm_output_data (2, 4, "DWARF macro version number");
if (DWARF_OFFSET_SIZE == 8)
@@ -24047,7 +24037,6 @@ output_macinfo (void)
case DW_MACINFO_undef:
output_macinfo_op (ref);
ref->code = 0;
- free (CONST_CAST (char *, ref->info));
ref->info = NULL;
break;
default:
diff --git a/gcc/gcc.c b/gcc/gcc.c
index d1dcdcb2ac7..5c1d16c328f 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6686,7 +6686,11 @@ main (int argc, char **argv)
/* Set up to remember the pathname of the lto wrapper. */
- lto_wrapper_file = find_a_file (&exec_prefixes, "lto-wrapper", X_OK, false);
+ if (have_c)
+ lto_wrapper_file = NULL;
+ else
+ lto_wrapper_file = find_a_file (&exec_prefixes, "lto-wrapper",
+ X_OK, false);
if (lto_wrapper_file)
{
lto_wrapper_spec = lto_wrapper_file;
@@ -7064,35 +7068,42 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2)
{
int tmp = execution_count;
+
+ if (! have_c)
+ {
#ifdef HAVE_LTO_PLUGIN
- const char *fno_use_linker_plugin = "fno-use-linker-plugin";
+ const char *fno_use_linker_plugin = "fno-use-linker-plugin";
#else
- const char *fuse_linker_plugin = "fuse-linker-plugin";
+ const char *fuse_linker_plugin = "fuse-linker-plugin";
#endif
- /* We'll use ld if we can't find collect2. */
- if (! strcmp (linker_name_spec, "collect2"))
- {
- char *s = find_a_file (&exec_prefixes, "collect2", X_OK, false);
- if (s == NULL)
- linker_name_spec = "ld";
- }
+ /* We'll use ld if we can't find collect2. */
+ if (! strcmp (linker_name_spec, "collect2"))
+ {
+ char *s = find_a_file (&exec_prefixes, "collect2", X_OK, false);
+ if (s == NULL)
+ linker_name_spec = "ld";
+ }
#ifdef HAVE_LTO_PLUGIN
- if (!switch_matches (fno_use_linker_plugin,
- fno_use_linker_plugin + strlen (fno_use_linker_plugin), 0))
+ if (!switch_matches (fno_use_linker_plugin,
+ fno_use_linker_plugin
+ + strlen (fno_use_linker_plugin), 0))
#else
- if (switch_matches (fuse_linker_plugin,
- fuse_linker_plugin + strlen (fuse_linker_plugin), 0))
+ if (switch_matches (fuse_linker_plugin,
+ fuse_linker_plugin
+ + strlen (fuse_linker_plugin), 0))
#endif
- {
- linker_plugin_file_spec = find_a_file (&exec_prefixes,
- LTOPLUGINSONAME, R_OK,
- false);
- if (!linker_plugin_file_spec)
- fatal_error ("-fuse-linker-plugin, but " LTOPLUGINSONAME " not found");
+ {
+ linker_plugin_file_spec = find_a_file (&exec_prefixes,
+ LTOPLUGINSONAME, R_OK,
+ false);
+ if (!linker_plugin_file_spec)
+ fatal_error ("-fuse-linker-plugin, but "
+ LTOPLUGINSONAME " not found");
+ }
+ lto_gcc_spec = argv[0];
}
- lto_gcc_spec = argv[0];
/* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
for collect. */
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 8dfd12c8eea..0c9f48b7a05 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -1,6 +1,6 @@
/* Register to Stack convert for GNU compiler.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1322,14 +1322,10 @@ compare_for_stack_reg (rtx insn, stack regstack, rtx pat_src)
static int
subst_stack_regs_in_debug_insn (rtx *loc, void *data)
{
- rtx *tloc = get_true_reg (loc);
stack regstack = (stack)data;
int hard_regno;
- if (!STACK_REG_P (*tloc))
- return 0;
-
- if (tloc != loc)
+ if (!STACK_REG_P (*loc))
return 0;
hard_regno = get_hard_regnum (regstack, *loc);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 95fde82576b..6a7ae2caf6c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2012-02-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/52132
+ * gcc.dg/pr52132.c: New test.
+
+2012-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51683
+ * gcc.dg/pr51683.c: New test.
+
2012-03-02 Peter Bergner <bergner@vnet.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/pr51683.c b/gcc/testsuite/gcc.dg/pr51683.c
new file mode 100644
index 00000000000..f5a4a8be485
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr51683.c
@@ -0,0 +1,18 @@
+/* PR tree-optimization/51683 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+static inline void *
+bar (void *p, void *q, int r)
+{
+ return __builtin_memcpy (p, q, r);
+}
+
+void *
+foo (void *p)
+{
+ return bar ((void *) 0x12345000, p, 256);
+}
+
+/* { dg-final { scan-tree-dump "memcpy" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/pr52132.c b/gcc/testsuite/gcc.dg/pr52132.c
new file mode 100644
index 00000000000..8374994424a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52132.c
@@ -0,0 +1,18 @@
+/* PR debug/52132 */
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -O2 -g" } */
+
+int l;
+void bar (void);
+
+void
+foo (int *x, float y)
+{
+ float b;
+ union { float f; int i; } u = { .f = y };
+ u.i += 127 << 23;
+ u.f = ((-1.0f / 3) * u.f + 2) * u.f - 2.0f / 3;
+ b = 0.5 * (u.f + l);
+ if (b >= *x)
+ bar ();
+}
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 8369f1fe6db..f6ef9da9074 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1,6 +1,6 @@
/* Conditional constant propagation pass for the GNU compiler.
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010, 2011 Free Software Foundation, Inc.
+ 2010, 2011, 2012 Free Software Foundation, Inc.
Adapted from original RTL SSA-CCP by Daniel Berlin <dberlin@dberlin.org>
Adapted to GIMPLE trees by Diego Novillo <dnovillo@redhat.com>
@@ -2372,6 +2372,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
case GIMPLE_CALL:
{
tree lhs = gimple_call_lhs (stmt);
+ int flags = gimple_call_flags (stmt);
tree val;
tree argt;
tree callee;
@@ -2383,7 +2384,10 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
type issues. */
if (lhs
&& TREE_CODE (lhs) == SSA_NAME
- && (val = get_constant_value (lhs)))
+ && (val = get_constant_value (lhs))
+ /* Don't optimize away calls that have side-effects. */
+ && (flags & (ECF_CONST|ECF_PURE)) != 0
+ && (flags & ECF_LOOPING_CONST_OR_PURE) == 0)
{
tree new_rhs = unshare_expr (val);
bool res;
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 7f1d84ebdfe..31eb6b5814b 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1032,6 +1032,12 @@ substitute_and_fold (ssa_prop_get_value_fn get_value_fn,
}
else if (is_gimple_call (def_stmt))
{
+ int flags = gimple_call_flags (def_stmt);
+
+ /* Don't optimize away calls that have side-effects. */
+ if ((flags & (ECF_CONST|ECF_PURE)) == 0
+ || (flags & ECF_LOOPING_CONST_OR_PURE))
+ continue;
if (update_call_from_tree (&gsi, val)
&& maybe_clean_or_replace_eh_stmt (def_stmt, gsi_stmt (gsi)))
gimple_purge_dead_eh_edges (gimple_bb (gsi_stmt (gsi)));
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 3a93b1d8d02..028a22d6f75 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -7742,9 +7742,14 @@ emit_note_insn_var_location (void **varp, void *data)
/* Make sure that the call related notes come first. */
while (NEXT_INSN (insn)
&& NOTE_P (insn)
- && NOTE_DURING_CALL_P (insn))
+ && ((NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
+ && NOTE_DURING_CALL_P (insn))
+ || NOTE_KIND (insn) == NOTE_INSN_CALL_ARG_LOCATION))
insn = NEXT_INSN (insn);
- if (NOTE_P (insn) && NOTE_DURING_CALL_P (insn))
+ if (NOTE_P (insn)
+ && ((NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
+ && NOTE_DURING_CALL_P (insn))
+ || NOTE_KIND (insn) == NOTE_INSN_CALL_ARG_LOCATION))
note = emit_note_after (NOTE_INSN_VAR_LOCATION, insn);
else
note = emit_note_before (NOTE_INSN_VAR_LOCATION, insn);