* toplev.c (rest_of_compilation): Don't run cross-jump before
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Apr 2002 23:13:36 +0000 (23:13 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Apr 2002 23:13:36 +0000 (23:13 +0000)
        bb-reorder.
* gcc.dg/20020430-1.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52981 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/gcc.dg/20020430-1.c [new file with mode: 0644]
gcc/toplev.c

index 1d0d6e8..2ae8455 100644 (file)
@@ -1,3 +1,9 @@
+2002-04-30  Richard Henderson  <rth@redhat.com>
+
+       PR opt/6516
+       * toplev.c (rest_of_compilation): Don't run cross-jump before
+       bb-reorder.
+
 2002-04-30  Tom Rix  <trix@redhat.com>
 
        * 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 (file)
index 0000000..981c4f3
--- /dev/null
@@ -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));
+}
index 5afeb1c..580384f 100644 (file)
@@ -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 ();