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]

Re: Patch for PR target/21721 (IA64 bug)


On Tue, Jun 07, 2005 at 01:50:18PM -0700, Steve Ellcey wrote:
> I am not saying register renaming couldn't be done correctly, just that
> the current implementation isn't correct.

I'm not sure why you're blaming register renaming for this pr.

The problem as I see it is that a tail call leaves all 64 predicate
registers live.  Normally this is just between the "mov pr = r, -1"
insn and the call, and nothing more comes of it.  In this case we 
wind up cross-jumping the tail call, and doing that in between the
pr reload and the call insn:

        mov pr = r112, -1
        .mii
        nop 0
        mov ar.pfs = r110
        ;;
        mov ar.lc = r25
.L1047:
	...
	br.sptk.many t1_close_font_file#
	...

        mov pr = r112, -1
        .mii
        nop 0
        mov ar.pfs = r110
        ;;
        mov ar.lc = r25
        .bbb
        nop 0
        nop 0
        br .L1047

Now, aside from wondering why we didn't cross-jump *more* code 
here, including the entire epilogue, this code is correct.  We
perform the pr reload on both paths.

The thing that causes the breakage is that we're pretty stupid
about emitting .pred.rel.mutex directives.  We assume the reason
they're live is because of actual predicate usage, rather than
a block move like this.

I'm not sure how it might be possible to fix this root cause.
We ought not just skip the entire emission of .pred.rel.mutex
just because p0 is live -- it would be legal to have real
predicate usage after the pr reload.

The simplest hack is to realize that a .pred.rel.mutex against
p0 is silly and skip it.



r~



	* config/ia64/ia64.c (emit_predicate_relation_info): Skip p0.

Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.347.2.8
diff -u -p -d -r1.347.2.8 ia64.c
--- config/ia64/ia64.c	19 May 2005 09:35:57 -0000	1.347.2.8
+++ config/ia64/ia64.c	8 Jun 2005 01:52:54 -0000
@@ -7392,7 +7392,9 @@ emit_predicate_relation_info (void)
 	  && NOTE_LINE_NUMBER (NEXT_INSN (head)) == NOTE_INSN_BASIC_BLOCK)
 	head = NEXT_INSN (head);
 
-      for (r = PR_REG (0); r < PR_REG (64); r += 2)
+      /* Skip p0, which may be thought to be live due to (reg:DI p0)
+	 grabbing the entire block of predicate registers.  */
+      for (r = PR_REG (2); r < PR_REG (64); r += 2)
 	if (REGNO_REG_SET_P (bb->global_live_at_start, r))
 	  {
 	    rtx p = gen_rtx_REG (BImode, r);


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