[PATCH][dataflow] Fix PR 32339, bad DF_REF_READ_WRITE marking
Seongbae Park (박성배, 朴成培)
seongbae.park@gmail.com
Fri Jun 15 15:07:00 GMT 2007
On 6/14/07, Seongbae Park (박성배, 朴成培) <seongbae.park@gmail.com> wrote:
> "flags" was modified, leaving later calls to df_uses_record
> to mark uses as DF_REF_READ_WRITE.
> This lead to missing REG_DEAD note for such a use,
> causing different views of live ranges
> between forward-scanning (global, using REG_DEAD)
> and backward-scanning (REG_N_CALLS_CROSSED, which is computed by
> regstat_bb_compute_ri).
> This inconsistent view lead to a call-clobbered hard register
> to not have a save area, but later was attempted to be spilled
> because a pseudo register that doesn't cross a live range got allocated to it
> and the forward scanning in global thought that the pseudo reg
> lives across the call.
>
> Bootstrapped and regtested on ia64.
> OK fo mainline ?
>
> ChangeLog:
>
> 2007-06-14 Seongbae Park <seongbae.park@gmail.com>
>
> PR rtl-optimization/32339
> * df-scan.c (df_uses_record): Don't modify flags but just add to it for
> df_ref_record.
> --
> #pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"
>
>
> Index: gcc/df-scan.c
> ===================================================================
> --- gcc/df-scan.c (revision 125735)
> +++ gcc/df-scan.c (working copy)
> @@ -2982,9 +2982,9 @@ df_uses_record (struct df_collection_rec
> case PRE_MODIFY:
> case POST_MODIFY:
> /* Catch the def of the register being modified. */
> - flags |= DF_REF_READ_WRITE | DF_REF_PRE_POST_MODIFY;
> df_ref_record (collection_rec, XEXP (x, 0), &XEXP (x, 0), bb, insn,
> - DF_REF_REG_DEF, flags);
> + DF_REF_REG_DEF,
> + flags | DF_REF_READ_WRITE | DF_REF_PRE_POST_MODIFY);
>
> /* ... Fall through to handle uses ... */
Andrew Pinski pointed out that I didn't add the testcase to our testsuite.
Here's the patch for adding the test.
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"
ChangeLog:
2007-06-15 Seongbae Park <seongbae.park@gmail.com>
PR rtl-optimization/32339
* gcc.c-torture/compile/pr32339.c: New test.
Index: testsuite/gcc.c-torture/compile/pr32339.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr32339.c (revision 0)
+++ testsuite/gcc.c-torture/compile/pr32339.c (revision 0)
@@ -0,0 +1,17 @@
+/* We used to ICE in insert_save at caller-save.c,
+ due to missing REG_DEAD for register use in post-decrement on ia64. */
+struct city_dialog
+{
+ struct city *pcity;
+ char change_list_names[200][200];
+ int change_list_ids[200];
+};
+change_callback (void)
+{
+ struct city_dialog *pdialog;
+ int n;
+ int i;
+ get_city_dialog_production_full (pdialog->change_list_names[n],
+ pdialog->pcity);
+ pdialog->change_list_ids[n++] = i;
+}
More information about the Gcc-patches
mailing list