This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3_0_BRANCH] Backport patch to fix KDE2 blocking bug PR 3387
- To: gcc-patches at gcc dot gnu dot org
- Subject: [3_0_BRANCH] Backport patch to fix KDE2 blocking bug PR 3387
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Tue, 11 Sep 2001 20:47:39 +0200
- Cc: Jakub Jelinek <jakub at redhat dot com>
Hi,
in an effort to get the "don't use gcc3 with KDE2" label removed I decided to
sleep with the devil and debug x86 stuff :-). After a short fight with my
rusty x86 assembly knowledge I was successful in tracking down the patch that
fixes this PR on the mainline.
I would like to commit the appended backported patch (and the original
testcase execute/20010403-1.c) to the branch, it fixes the posted testcase
and also works in the original context producing a working libxml2 on x86.
Jakub, do you by chance remember if this patch relies on anything that may
not be on the branch yet? Maybe this one:
Wed Apr 4 00:45:38 EDT 2001 John Wehle (john@feith.com)
* rtl.h (set_noop_p): Declare.
* flow.c (set_noop_p): Move from here ...
* rtlanal.c (set_noop_p): ... to here and enhance.
* cse.c (delete_trivially_dead_insns): Use it.
* gcse.c (hash_scan_set): Likewise.
* jump.c (delete_noop_moves): Likewise.
* recog.c (split_all_insns): Likewise.
?
Bootstrapped and regtested the branch on x86-linux and ppc-linux (with Jim
Wilson's fixup patch applied).
OK to commit to the branch?
Franz.
2001-04-20 Jakub Jelinek <jakub@redhat.com>
* gcse.c (gcse_main): Fix comment typo.
(delete_null_pointer_check): Likewise.
(hash_scan_set): Don't consider sets with REG_EQUIV MEM notes.
* cse.c (cse_insn): Likewise.
* function.c (fixup_var_refs_insns_with_hash): The sequence is
toplevel.
Index: gcc/cse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cse.c,v
retrieving revision 1.174.2.5
diff -u -p -r1.174.2.5 cse.c
--- gcc/cse.c 2001/07/26 18:27:52 1.174.2.5
+++ gcc/cse.c 2001/09/11 08:21:57
@@ -5060,18 +5069,16 @@ cse_insn (insn, libcall_insn)
sets[i].src_in_memory = hash_arg_in_memory;
/* If SRC is a MEM, there is a REG_EQUIV note for SRC, and DEST is
- a pseudo that is set more than once, do not record SRC. Using
- SRC as a replacement for anything else will be incorrect in that
- situation. Note that this usually occurs only for stack slots,
- in which case all the RTL would be referring to SRC, so we don't
- lose any optimization opportunities by not having SRC in the
- hash table. */
+ a pseudo, do not record SRC. Using SRC as a replacement for
+ anything else will be incorrect in that situation. Note that
+ this usually occurs only for stack slots, in which case all the
+ RTL would be referring to SRC, so we don't lose any optimization
+ opportunities by not having SRC in the hash table. */
if (GET_CODE (src) == MEM
- && find_reg_note (insn, REG_EQUIV, src) != 0
+ && find_reg_note (insn, REG_EQUIV, NULL_RTX) != 0
&& GET_CODE (dest) == REG
- && REGNO (dest) >= FIRST_PSEUDO_REGISTER
- && REG_N_SETS (REGNO (dest)) != 1)
+ && REGNO (dest) >= FIRST_PSEUDO_REGISTER)
sets[i].src_volatile = 1;
#if 0
Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.250.2.13
diff -u -p -r1.250.2.13 function.c
--- gcc/function.c 2001/08/06 21:26:24 1.250.2.13
+++ gcc/function.c 2001/09/11 08:22:02
@@ -1680,7 +1680,7 @@ fixup_var_refs_insns_with_hash (ht, var,
rtx insn = XEXP (insn_list, 0);
if (INSN_P (insn))
- fixup_var_refs_insn (insn, var, promoted_mode, unsignedp, 0);
+ fixup_var_refs_insn (insn, var, promoted_mode, unsignedp, 1);
insn_list = XEXP (insn_list, 1);
}
Index: gcc/gcse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcse.c,v
retrieving revision 1.113.4.2
diff -u -p -r1.113.4.2 gcse.c
--- gcc/gcse.c 2001/04/11 18:06:52 1.113.4.2
+++ gcc/gcse.c 2001/09/11 08:22:05
@@ -681,7 +681,7 @@ gcse_main (f, file)
a high connectivity will take a long time and is unlikely to be
particularly useful.
- In normal circumstances a cfg should have about twice has many edges
+ In normal circumstances a cfg should have about twice as many edges
as blocks. But we do not want to punish small functions which have
a couple switch statements. So we require a relatively large number
of basic blocks and the ratio of edges to blocks to be high. */
@@ -1924,6 +1924,7 @@ hash_scan_set (pat, insn, set_p)
{
rtx src = SET_SRC (pat);
rtx dest = SET_DEST (pat);
+ rtx note;
if (GET_CODE (src) == CALL)
hash_scan_call (src, insn);
@@ -1939,7 +1940,15 @@ hash_scan_set (pat, insn, set_p)
/* Don't GCSE something if we can't do a reg/reg copy. */
&& can_copy_p [GET_MODE (dest)]
/* Is SET_SRC something we want to gcse? */
- && want_to_gcse_p (src))
+ && want_to_gcse_p (src)
+ /* Don't GCSE if it has attached REG_EQUIV note.
+ At this point this only function parameters should have
+ REG_EQUIV notes and if the argument slot is used somewhere
+ explicitely, it means address of parameter has been taken,
+ so we should not extend the lifetime of the pseudo. */
+ && ((note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) == 0
+ || GET_CODE (XEXP (note, 0)) != MEM))
+
{
/* An expression is not anticipatable if its operands are
modified before this insn. */
@@ -5173,7 +5182,7 @@ delete_null_pointer_checks (f)
a high connectivity will take a long time and is unlikely to be
particularly useful.
- In normal circumstances a cfg should have about twice has many edges
+ In normal circumstances a cfg should have about twice as many edges
as blocks. But we do not want to punish small functions which have
a couple switch statements. So we require a relatively large number
of basic blocks and the ratio of edges to blocks to be high. */