From 8e8c38cddd8e5b6921b038667216326fb36681a0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 30 Apr 2002 16:13:36 -0700 Subject: [PATCH] toplev.c (rest_of_compilation): Don't run cross-jump before bb-reorder. * toplev.c (rest_of_compilation): Don't run cross-jump before bb-reorder. * gcc.dg/20020430-1.c: New. From-SVN: r52981 --- gcc/ChangeLog | 6 + gcc/testsuite/gcc.dg/20020430-1.c | 190 ++++++++++++++++++++++++++++++ gcc/toplev.c | 10 +- 3 files changed, 201 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/20020430-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d0d6e863f9..2ae84559455 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-04-30 Richard Henderson + + PR opt/6516 + * toplev.c (rest_of_compilation): Don't run cross-jump before + bb-reorder. + 2002-04-30 Tom Rix * regrename.c (build_def_use, copyprop_hardreg_forward_1): Sanity diff --git a/gcc/testsuite/gcc.dg/20020430-1.c b/gcc/testsuite/gcc.dg/20020430-1.c new file mode 100644 index 00000000000..981c4f36dab --- /dev/null +++ b/gcc/testsuite/gcc.dg/20020430-1.c @@ -0,0 +1,190 @@ +/* PR opt/6516 */ +/* On x86, something about the structure of this function prevented + cross-jumping from combining the three arms of the switch statement + until the last moment. After which we did not delete dead code, + which left a reference to the deleted ADDR_VEC. */ + +/* { dg-do compile } +/* { do-options "-O2 -frename-registers -fpic" } */ + +typedef unsigned long XID; +typedef XID Window; +typedef void Display; +typedef unsigned long Time; + +typedef struct { + int type; + unsigned long serial; + int send_event; + Display *display; + Window window; + Window root; + Window subwindow; + Time time; + int x, y; + int x_root, y_root; + unsigned int state; + unsigned int button; + int same_screen; +} XButtonEvent; +typedef struct { + int type; + unsigned long serial; + int send_event; + Display *display; + Window window; + Window root; + Window subwindow; + Time time; + int x, y; + int x_root, y_root; + unsigned int state; + char is_hint; + int same_screen; +} XMotionEvent; +typedef struct { + int type; + unsigned long serial; + int send_event; + Display *display; + Window window; + Window root; + Window subwindow; + Time time; + int x, y; + int x_root, y_root; + int mode; + int detail; + int same_screen; + int focus; + unsigned int state; +} XCrossingEvent; +typedef union _XEvent { + int type; + XButtonEvent xbutton; + XMotionEvent xmotion; + XCrossingEvent xcrossing; +} XEvent; + +typedef struct { + int width, height; + Display *display; +} Screen; +typedef struct _CorePart { + Screen *screen; +} CorePart; +typedef struct _WidgetRec { + CorePart core; +} WidgetRec; +typedef struct _WidgetRec *Widget; + +typedef struct _SmeRec *SmeObject; +typedef struct _SimpleMenuPart { + SmeObject entry_set; +} SimpleMenuPart; +typedef struct _SimpleMenuRec { + SimpleMenuPart simple_menu; +} SimpleMenuRec; +typedef struct _SimpleMenuRec* SimpleMenuWidget; + +typedef short Position; +typedef unsigned short Dimension; +typedef char Boolean; + +typedef struct _RectObjPart { + Position x, y; + Dimension width, height; + Dimension border_width; + Boolean managed; + Boolean sensitive; + Boolean ancestor_sensitive; +}RectObjPart; +typedef struct _RectObjRec { + RectObjPart rectangle; +} RectObjRec; +typedef struct _RectObjRec *RectObj; + +SmeObject DoGetEventEntry(); + +SmeObject +GetEventEntry(Widget w, XEvent *event) +{ + int x_loc, y_loc, x_root; + SimpleMenuWidget smw = (SimpleMenuWidget)w; + SmeObject entry; + int warp, move; + switch (event->type) { + case 6: + x_loc = event->xmotion.x; + y_loc = event->xmotion.y; + x_root = event->xmotion.x_root; + break; + case 7: + case 8: + x_loc = event->xcrossing.x; + y_loc = event->xcrossing.y; + x_root = event->xcrossing.x_root; + break; + case 4: + case 5: + x_loc = event->xbutton.x; + y_loc = event->xbutton.y; + x_root = event->xbutton.x_root; + break; + default: + XtAppError(XtWidgetToApplicationContext(w), + "Unknown event type in GetEventEntry()."); + return (((void *)0)); + } + if (x_loc < 0 || x_loc >= (((RectObj)smw)->rectangle.width) || + y_loc < 0 || y_loc >= (((RectObj)smw)->rectangle.height)) + return (((void *)0)); + if (x_root == ((((w)->core.screen))->width) - 1 && + (((RectObj)w)->rectangle.x) + (((RectObj)w)->rectangle.width) + ((((RectObj)w)->rectangle.border_width)) > x_root) { + warp = -8; + if (smw->simple_menu.entry_set) { + entry = DoGetEventEntry(w, + (((RectObj)smw->simple_menu.entry_set)->rectangle.x) + + (((RectObj)smw->simple_menu.entry_set)->rectangle.width) + 1, + y_loc); + Unhighlight(w, event, ((void *)0), ((void *)0)); + if (entry) { + warp = -(int)(((RectObj)entry)->rectangle.width) >> 1; + move = x_loc - (((RectObj)entry)->rectangle.width) - (((RectObj)entry)->rectangle.x) + (((RectObj)w)->rectangle.border_width); + } + else { + warp = 0; + move = ((((w)->core.screen))->width) - + ((((RectObj)w)->rectangle.x) + (((RectObj)w)->rectangle.width) + ((((RectObj)w)->rectangle.border_width) << 1)); + } + } + else { + warp = 0; + move = ((((w)->core.screen))->width) - + ((((RectObj)w)->rectangle.x) + (((RectObj)w)->rectangle.width) + ((((RectObj)w)->rectangle.border_width) << 1)); + } + } + else if (x_root == 0 && (((RectObj)w)->rectangle.x) < 0) { + warp = 8; + if (smw->simple_menu.entry_set) { + entry = DoGetEventEntry(w, (((RectObj)smw->simple_menu.entry_set)->rectangle.x) - 1, + y_loc); + Unhighlight(w, event, ((void *)0), ((void *)0)); + if (entry) { + warp = (((RectObj)entry)->rectangle.width) >> 1; + move = x_loc - (((RectObj)entry)->rectangle.x); + } + else + move = x_loc + (((RectObj)w)->rectangle.border_width); + } + else + move = x_loc + (((RectObj)w)->rectangle.border_width); + } + else + move = warp = 0; + if (move) + XtMoveWidget(w, (((RectObj)w)->rectangle.x) + move, (((RectObj)w)->rectangle.y)); + if (warp) + XWarpPointer((((w)->core.screen)->display), 0L, 0L, 0, 0, 0, 0, warp, 0); + return (DoGetEventEntry(w, x_loc, y_loc)); +} diff --git a/gcc/toplev.c b/gcc/toplev.c index 5afeb1c09d1..580384f184c 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3309,11 +3309,11 @@ rest_of_compilation (decl) timevar_push (TV_REORDER_BLOCKS); open_dump_file (DFI_bbro, decl); - /* Last attempt to optimize CFG, as scheduling, peepholing - and insn splitting possibly introduced more crossjumping - oppurtuntities. */ - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK - | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)); + /* Last attempt to optimize CFG, as scheduling, peepholing and insn + splitting possibly introduced more crossjumping oppurtuntities. + Except that we can't actually run crossjumping without running + another DCE pass, which we can't do after reg-stack. */ + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK); if (flag_reorder_blocks) { reorder_basic_blocks (); -- 2.30.2