public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Flow analysis confused by exception handling
@ 1997-12-02  1:47 Teemu Torma
  0 siblings, 0 replies; 5+ messages in thread
From: Teemu Torma @ 1997-12-02  1:47 UTC (permalink / raw)
  To: egcs

The problem I sent few days ago about register being clobbered
in sparc while throwing seems to be actually flow analysis problem.
In the following code, the initial assignment to `i' gets deleted
because the next instruction also assigns it.

The rtl dump after the second cse looks like:

(insn 11 8 13 (set (reg/v:SI 105)
        (const_int 0)) 111 {*movsi_insn} (nil)
    (expr_list:REG_EQUAL (const_int 0)
        (nil)))

(note 13 11 15 13 NOTE_INSN_EH_REGION_BEG)

(note 15 13 17 "" NOTE_INSN_DELETED)

(note 17 15 19 "" NOTE_INSN_DELETED)

(call_insn 19 17 21 (parallel[ 
            (set (reg:SI 8 %o0)
                (call (mem:SI (symbol_ref:SI ("bar__Fv")))
                    (const_int 0)))
            (clobber (reg:SI 15 %o7))
        ] ) -1 (nil)
    (nil)
    (nil))

But after the flow analysis, the assignment to zero is gone:

(note 8 7 11 "" NOTE_INSN_DELETED)

;; Start of basic block 0, registers live: 14 [%sp] 30 [%fp] 31 [%i7]
(note 11 8 13 "" NOTE_INSN_DELETED)

(note 13 11 15 13 NOTE_INSN_EH_REGION_BEG)

(note 15 13 17 "" NOTE_INSN_DELETED)

(note 17 15 19 "" NOTE_INSN_DELETED)

(call_insn 19 17 21 (parallel[ 
            (set (reg:SI 8 %o0)
                (call (mem:SI (symbol_ref:SI ("bar__Fv")))
                    (const_int 0)))
            (clobber (reg:SI 15 %o7))
        ] ) -1 (nil)
    (expr_list:REG_UNUSED (reg:SI 15 %o7)
        (nil))
    (nil))

This would be right if bar wouldn't throw anything, but it is
clearly wrong because insn 19 does not actually assign anything.

Teemu

---------------------------------------------------------------------------
#include <stdio.h>

int bar ()
{
  throw 100;
}

main ()
{
  int i = 0;			// this gets deleted after flow analysis
  try
    {
      i = bar ();
    }
  catch (...)
    {
    }

  printf ("i = %d\n", i);
  return i;
}
---------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <199712020947.KAA05490.cygnus.egcs@lev.labs.trema.com>]
* Re: Flow analysis confused by exception handling
@ 1997-12-03  4:36 meissner
  0 siblings, 0 replies; 5+ messages in thread
From: meissner @ 1997-12-03  4:36 UTC (permalink / raw)
  To: amylaar, law; +Cc: egcs, jason, tot

| The schedulers rely on basic_block_{head,end} do delimit basic block
| boundaries.  Similarly for most passes after flow.

Just a reminder, this is true for the passes after flow and up to reload.
Reload seriously damages the flow information (insns created by reload that are
adjacent to basic blocks, won't be added to any basic block).

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

end of thread, other threads:[~1997-12-03  4:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-02  1:47 Flow analysis confused by exception handling Teemu Torma
     [not found] <199712020947.KAA05490.cygnus.egcs@lev.labs.trema.com>
1997-12-02  2:25 ` Jason Merrill
1997-12-02 13:14   ` Joern Rennecke
1997-12-02 16:29     ` Jeffrey A Law
1997-12-03  4:36 meissner

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).