This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix speculative prefetch profiler bug


This patch fixes a problem with the speculative prefetch value profiler. If the instruction stream contains
an instruction like the following,


(insn 633 621 84 my-file.c:184 (clobber (mem:BLK (scratch) [0 A8])) -1 (ni) nil))

the value profiler notices that it is an instruction that writes to memory, and decides to try to profile it.
Eventually the register "(scratch)" gets passed into int_mode_for_mode (through rtl_gen_const_delta_profiler and convert_move), with VOIDmode, which causes an internal error.


It seems to me that instructions of this particular form should really not be of interest to the
speculative prefetch value profiler, so the following patch tells it not to profile such instructions, which
solves the problem. (If anyone believes there is a better approach to take, please let me know).


Due to various bootstrap/profiledbootstrap problems I'm currently having on my architecture, this
has only been tested on my small test case. I am planning on doing bootstraps and DejaGnu tests
before committing this (on G4 running powerpc-apple-darwin and x86 running Linux).


Assuming it passes the tests, is this okay to commit to FSF mainline?

-- Caroline Tice
ctice@apple.com

2004-09-08 Caroline Tice <ctice@apple.com>

* value-prof.c (insn_prefetch_values_to_profile): Remove "clobber (mem:BLK (scratch)" insns
from consideration for profiling.



Index: gcc/value-prof.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/value-prof.c,v retrieving revision 1.14 diff -c -3 -p -r1.14 value-prof.c *** gcc/value-prof.c 5 Sep 2004 15:24:15 -0000 1.14 --- gcc/value-prof.c 8 Sep 2004 22:06:07 -0000 *************** insn_prefetch_values_to_profile (rtx ins *** 255,260 **** --- 255,264 ---- if (side_effects_p (address)) return false;

+   if (GET_CODE (address) == SCRATCH
+       && GET_CODE (PATTERN (insn)) == CLOBBER)
+     return false;
+
    if (CONSTANT_P (address))
      return false;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]