public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/7409: loop optimization
@ 2002-07-26  5:16 Bernhard Kaindl
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Kaindl @ 2002-07-26  5:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3429 bytes --]

The following reply was made to PR optimization/7409; it has been noted by GNATS.

From: Bernhard Kaindl <bk@suse.de>
To: <hpenner@de.ibm.com>
Cc: <gcc-gnats@gcc.gnu.org>, <mark@codesourcery.com>,
	<uweigand@de.ibm.com>, <nobody@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>, Reinhard Max <max@suse.de>
Subject: Re: optimization/7409: loop optimization 
Date: Fri, 26 Jul 2002 14:11:51 +0200 (CEST)

 On 25 Jul 2002 hpenner@de.ibm.com wrote:
 > >Description:
 > loop_optimize deletes an insn, which should not be deleted.
 > This leads to a abort of an application (tcl).
 
 Yes, it leads to an abort in different 8.x tcl versions when
 running the included testsuite on s390x with gcc-3.1.1-cvs,
 but it looks like it can be worked around by changing the
 -O1 in the Makefile ot -O0 or -O2.
 
 Just to bring all the info together, I append some mails
 also describing the problem, a testcase and a proposed fix.
 
 ---------- Forwarded message ----------
 From: Hartmut Penner <HPENNER@de.ibm.com>
 To: mark@codesourcery.com, gcc-patches@gcc.gnu.org
 Cc: uweigand@de.ibm.com
 Date: Thu, 25 Jul 2002 19:53:53 +0200
 Subject: PR 7409/Loop optimization bug patch
 
 A proposed patch for problem described in PR7409 is appended here.
 The problem was, that the usage of a register as a parameter was not taken
 into acount in the function find_single_use_in_loop.
 
 Index: loop.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/loop.c,v
 retrieving revision 1.389.2.7
 diff -u -r1.389.2.7 loop.c
 --- loop.c      15 Jun 2002 01:12:04 -0000      1.389.2.7
 +++ loop.c      25 Jul 2002 17:41:28 -0000
 @@ -3448,6 +3448,19 @@
    const char *fmt = GET_RTX_FORMAT (code);
    int i, j;
 
 +  if (x == PATTERN (insn) && GET_CODE (insn) == CALL_INSN)
 +    {
 +      rtx link;
 +      for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
 +       {
 +         rtx op, reg;
 +
 +         if (GET_CODE (op = XEXP (link, 0)) == USE
 +             && GET_CODE (reg = XEXP (op, 0)) == REG)
 +           regs->array[REGNO (reg)].single_usage = const0_rtx;
 +       }
 +    }
 +
    if (code == REG)
      regs->array[REGNO (x)].single_usage
        = (regs->array[REGNO (x)].single_usage != 0
 
 
 
 Mit freundlichem Gruß / Best regards,
 
 Hartmut Penner
 GCC for S/390 Development
 
 ---------- Forwarded message ----------
 
 The testcase is from Tcl and is accessibel there under the name tclUtil
 which is the file where the problem appears:
 
 http://www.suse.de/~bk/gcc/testcases/
 
 cc -S -g -O1 -fPIC tclUtil.i
 
 This is the assembler code generated to call TclFindElement (only one
 place in the file):
 
         lgfr    %r4,%r8
         la      %r1,184(%r15)
         stg     %r1,160(%r15)
         la      %r1,188(%r15)
         stg     %r1,168(%r15)
         lg      %r2,200(%r15)
         lgr     %r3,%r10
         la      %r5,192(%r15)
 +       la      %r6,176(%r15)
         brasl   %r14,TclFindElement@PLT
 
 Adding the line marked with + fixes the passing of a pointer onto the
 stack and fixes this particulare case.
 
 There are other cases on tcl which -O1 also cause segementation violations,
 I hope that the other cases are also fixed with the patch above, it's likely
 that the conditions of the other uses of TclFindElement are similar.
 
 Best Regards
 Bernhard Kaindl
 
 Research & Development  SuSE Linux S/390 and zSeries
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: optimization/7409: loop optimization
@ 2002-10-15 10:04 uweigand
  0 siblings, 0 replies; 3+ messages in thread
From: uweigand @ 2002-10-15 10:04 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, hpenner, mark, uweigand, nobody, uweigand

Synopsis: loop optimization

Responsible-Changed-From-To: unassigned->uweigand
Responsible-Changed-By: uweigand
Responsible-Changed-When: Tue Oct 15 10:04:09 2002
Responsible-Changed-Why:
    Fixed.
State-Changed-From-To: open->closed
State-Changed-By: uweigand
State-Changed-When: Tue Oct 15 10:04:09 2002
State-Changed-Why:
    Fixed in 3.2.1 and 3.3.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7409


^ permalink raw reply	[flat|nested] 3+ messages in thread

* optimization/7409: loop optimization
@ 2002-07-25 10:36 hpenner
  0 siblings, 0 replies; 3+ messages in thread
From: hpenner @ 2002-07-25 10:36 UTC (permalink / raw)
  To: gcc-gnats; +Cc: mark, uweigand


>Number:         7409
>Category:       optimization
>Synopsis:       loop optimization
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 25 10:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     hpenner@de.ibm.com
>Release:        3.1.1 20020725 (prerelease)
>Organization:
>Environment:
s390x-linux-gnu 
>Description:
loop_optimize deletes an insn, which should not be deleted.
This leads to a abort of an application (tcl).

Scenario:

(set (reg 128) (plus (reg fp) (const_int 176)))

(set (reg 6) (reg 128))

(set (reg 2) call ()
    (expr_list (use (reg 6))))

(set (reg 96) (reg 6))

Loop optimizer thinks register 6 is in single usage, and hence delete the insn which sets register 6. This is done,
since register 6 is call-saved and a parameter.
Delete code in loop.c:876-909.
 

    
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-15 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-26  5:16 optimization/7409: loop optimization Bernhard Kaindl
  -- strict thread matches above, loose matches on Subject: below --
2002-10-15 10:04 uweigand
2002-07-25 10:36 hpenner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).