public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/28850]  New: missed call -> jmp transformation; redundant unwind stuff.
@ 2006-08-25 20:40 pluto at agmk dot net
  2006-08-25 21:52 ` [Bug tree-optimization/28850] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: pluto at agmk dot net @ 2006-08-25 20:40 UTC (permalink / raw)
  To: gcc-bugs

$ cat fake_bomber.cpp

struct bomber
{
        bomber() : bum( false ) { }
        ~bomber() { if ( bum ) throw 0; }  // this will never throw
private:
        bool bum;
};

void zoo() { }

void bar( void ( *f )() )
{
#ifndef CALL2JMP
        bomber b; // fake bomber
#endif
        f();
}

void foo()
{
#ifndef CALL2JMP
        bomber b; // fake bomber
#endif
        bar( &zoo );
}

int main()
{
        foo();
        return 0;
}

$ g++ fake_bomber.cpp -o fake_bomber -O3 -fno-rtti --save-temps

zoo():
        rep ; ret

bar(void (*)()):
        subq    $8, %rsp
        call    *%rdi
        addq    $8, %rsp
        ret
        movq    %rax, %rdi
        call    _Unwind_Resume

foo():
        subq    $8, %rsp
        movl    zoo(), %edi
        call    bar(void (*)())
        addq    $8, %rsp
        ret
        movq    %rax, %rdi
        call    _Unwind_Resume

main:
        subq    $8, %rsp
        call    foo()
        xorl    %eax, %eax
        addq    $8, %rsp
        ret

$ g++ fake_bomber.cpp -o fake_bomber -O3 -fno-rtti --save-temps -DCALL2JMP

zoo():
        rep ; ret

bar(void (*)()):
        movq    %rdi, %r11
        jmp     *%r11

foo():
        rep ; ret

main:
        xorl    %eax, %eax
        ret


-- 
           Summary: missed call -> jmp transformation; redundant unwind
                    stuff.
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: x86-64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28850


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

* [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff.
  2006-08-25 20:40 [Bug tree-optimization/28850] New: missed call -> jmp transformation; redundant unwind stuff pluto at agmk dot net
@ 2006-08-25 21:52 ` rguenth at gcc dot gnu dot org
  2006-08-25 21:59 ` [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-08-25 21:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-08-25 21:51 -------
It's not entirely clear from your report, but this looks like a bug of PR13397?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28850


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

* [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally
  2006-08-25 20:40 [Bug tree-optimization/28850] New: missed call -> jmp transformation; redundant unwind stuff pluto at agmk dot net
  2006-08-25 21:52 ` [Bug tree-optimization/28850] " rguenth at gcc dot gnu dot org
@ 2006-08-25 21:59 ` pinskia at gcc dot gnu dot org
  2006-08-26 10:07 ` rguenth at gcc dot gnu dot org
  2009-03-29 13:32 ` hubicka at gcc dot gnu dot org
  3 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-25 21:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-08-25 21:59 -------
(In reply to comment #1)
> It's not entirely clear from your report, but this looks like a bug of PR13397?
No it is not fully related.  One of the problems is that we don't remove empty
finnally blocks.

Reduced testcase for that problem:
struct bomber
{
        ~bomber() {  }
};
int g(void);
int f(void)
{
  bomber a;
  g();
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-08-25 21:59:14
               date|                            |
            Summary|missed call -> jmp          |missed call -> jmp
                   |transformation; redundant   |transformation; redundant
                   |unwind stuff.               |unwind stuff with empty
                   |                            |finally


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28850


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

* [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally
  2006-08-25 20:40 [Bug tree-optimization/28850] New: missed call -> jmp transformation; redundant unwind stuff pluto at agmk dot net
  2006-08-25 21:52 ` [Bug tree-optimization/28850] " rguenth at gcc dot gnu dot org
  2006-08-25 21:59 ` [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally pinskia at gcc dot gnu dot org
@ 2006-08-26 10:07 ` rguenth at gcc dot gnu dot org
  2009-03-29 13:32 ` hubicka at gcc dot gnu dot org
  3 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-08-26 10:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-08-26 10:07 -------
Indeed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
           Keywords|                            |missed-optimization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28850


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

* [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally
  2006-08-25 20:40 [Bug tree-optimization/28850] New: missed call -> jmp transformation; redundant unwind stuff pluto at agmk dot net
                   ` (2 preceding siblings ...)
  2006-08-26 10:07 ` rguenth at gcc dot gnu dot org
@ 2009-03-29 13:32 ` hubicka at gcc dot gnu dot org
  3 siblings, 0 replies; 7+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2009-03-29 13:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hubicka at gcc dot gnu dot org  2009-03-29 13:32 -------
Subject: Bug 28850

Author: hubicka
Date: Sun Mar 29 13:32:13 2009
New Revision: 145233

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145233
Log:

        PR middle-end/28850
        * tree-pass.h (pass_cleanup_eh): New function.
        (remove_unreachable_regions): Break code handling RTL
        to rtl_remove_unreachable_regions; remove ERT_MUST_NOT_THROW
        that can not be reached by runtime.
        (can_be_reached_by_runtime): New function.
        (label_to_region_map): New function.
        (num_eh_regions): New function.
        (rtl_remove_unreachable_regions): New function.
        (convert_from_eh_region_ranges): Call rtl_remove_unreachable_regions.
        (remove_eh_region): New function.
        * except.h: Include sbitmap and vecprim.
        (remove_eh_region, remove_unreachable_regions, label_to_region_map,
        num_eh_regions): Declare.
        * passes.c (init_optimization_passes): Schedule cleanup_eh.
        * Makefile.in (EXCEPT_H): New; replace all uses of except.h
        by it.
        * tree-eh.c (tree_remove_unreachable_handlers): New function.
        (tree_empty_eh_handler_p): New function.
        (cleanup_empty_eh): New function.
        (cleanup_eh): New function.
        (pass_cleanup_eh): New function.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/except.c
    trunk/gcc/except.h
    trunk/gcc/passes.c
    trunk/gcc/tree-eh.c
    trunk/gcc/tree-pass.h


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28850


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

* [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally
       [not found] <bug-28850-4@http.gcc.gnu.org/bugzilla/>
  2011-06-22 22:05 ` pluto at agmk dot net
@ 2021-12-25  6:12 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-25  6:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28850

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2006-08-25 21:59:14         |2021-12-24
           Keywords|patch                       |EH

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
When we get to tailc pass we have the following IR still:


;; Function bar (_Z3barPFvvE, funcdef_no=7, decl_uid=4010, cgraph_uid=8,
symbol_order=7)

void bar (void (*<T5e0>) (void) f)
{
;;   basic block 2, loop depth 0
;;    pred:       ENTRY
  f_2(D) ();
;;    succ:       4
;;                3

;;   basic block 3, loop depth 0
;;    pred:       2
  return;
;;    succ:       EXIT

;;   basic block 4, loop depth 0
;;    pred:       2
<L0>:
  resx 2
;;    succ:      

}

And the resx is removed while in resx pass while we might as well remove it
before hand really because the bb is empty otherwise.

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

* [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally
       [not found] <bug-28850-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-22 22:05 ` pluto at agmk dot net
  2021-12-25  6:12 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 7+ messages in thread
From: pluto at agmk dot net @ 2011-06-22 22:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28850

Pawel Sikora <pluto at agmk dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.6.1

--- Comment #5 from Pawel Sikora <pluto at agmk dot net> 2011-06-22 22:05:16 UTC ---
call->jmp still not transformed for original testcase.


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

end of thread, other threads:[~2021-12-25  6:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-25 20:40 [Bug tree-optimization/28850] New: missed call -> jmp transformation; redundant unwind stuff pluto at agmk dot net
2006-08-25 21:52 ` [Bug tree-optimization/28850] " rguenth at gcc dot gnu dot org
2006-08-25 21:59 ` [Bug tree-optimization/28850] missed call -> jmp transformation; redundant unwind stuff with empty finally pinskia at gcc dot gnu dot org
2006-08-26 10:07 ` rguenth at gcc dot gnu dot org
2009-03-29 13:32 ` hubicka at gcc dot gnu dot org
     [not found] <bug-28850-4@http.gcc.gnu.org/bugzilla/>
2011-06-22 22:05 ` pluto at agmk dot net
2021-12-25  6:12 ` pinskia at gcc dot gnu.org

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