OSDN Git Service

2010-10-13 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Oct 2010 15:42:46 +0000 (15:42 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Oct 2010 15:42:46 +0000 (15:42 +0000)
PR tree-optimization/45788
* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Delay
EH update until fixup-cfg.

* g++.dg/pr45788.C: New testcase.

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

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr45788.C [new file with mode: 0644]

index 386b2ab..807b7f9 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-13  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/45788
+       * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Delay
+       EH update until fixup-cfg.
+
 2010-10-13  Julian Brown  <julian@codesourcery.com>
 
        * config/arm/arm.h (REG_CLASS_CONTENTS): Remove soft frame pointer
index 95f30e2..95b3007 100644 (file)
@@ -2156,6 +2156,7 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
   if (e->callee->clone.combined_args_to_skip)
     {
       gimple_stmt_iterator gsi;
+      int lp_nr;
 
       new_stmt
        = gimple_call_copy_skip_args (e->call_stmt,
@@ -2168,16 +2169,22 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
 
       gsi = gsi_for_stmt (e->call_stmt);
       gsi_replace (&gsi, new_stmt, false);
-      if (maybe_clean_or_replace_eh_stmt (e->call_stmt, new_stmt))
-       gimple_purge_dead_eh_edges (gimple_bb (new_stmt));
+      /* We need to defer cleaning EH info on the new statement to
+         fixup-cfg.  We may not have dominator information at this point
+        and thus would end up with unreachable blocks and have no way
+        to communicate that we need to run CFG cleanup then.  */
+      lp_nr = lookup_stmt_eh_lp (e->call_stmt);
+      if (lp_nr != 0)
+       {
+         remove_stmt_from_eh_lp (e->call_stmt);
+         add_stmt_to_eh_lp (new_stmt, lp_nr);
+       }
     }
   else
     {
       new_stmt = e->call_stmt;
       gimple_call_set_fndecl (new_stmt, e->callee->decl);
       update_stmt (new_stmt);
-      if (maybe_clean_eh_stmt (new_stmt))
-       gimple_purge_dead_eh_edges (gimple_bb (new_stmt));
     }
 
   cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt);
index 65ca05c..537a507 100644 (file)
@@ -1,5 +1,10 @@
 2010-10-13  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/45788
+       * g++.dg/pr45788.C: New testcase.
+
+2010-10-13  Richard Guenther  <rguenther@suse.de>
+
        PR tree-optimization/45970
        * gcc.dg/tree-ssa/ssa-dse-13.c: New testcase.
 
diff --git a/gcc/testsuite/g++.dg/pr45788.C b/gcc/testsuite/g++.dg/pr45788.C
new file mode 100644 (file)
index 0000000..de3340d
--- /dev/null
@@ -0,0 +1,108 @@
+// { dg-do compile { target x86_64-*-* } }
+// { dg-options "-O3 -fwhole-program -msse2" }
+
+typedef long unsigned int __darwin_size_t;
+typedef __darwin_size_t size_t;
+
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_mul_ps (__m128 __A, __m128 __B) {
+    return (__m128) __builtin_ia32_mulps ((__v4sf)__A, (__v4sf)__B);
+}
+extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_set1_ps (float __F) {
+    return __extension__ (__m128)(__v4sf){
+       __F, __F, __F, __F };
+}
+extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_setr_ps (float __Z, float __Y, float __X, float __W) {
+}
+typedef float real;
+template <typename T, int N> struct vectorX {
+};
+template<> struct vectorX<float, 3> {
+    union {
+       __m128 s;
+       struct {
+       };
+    };
+    vectorX(__m128 s) : s(s) {
+    }
+
+}
+__attribute__((aligned));
+template<> struct vectorX<float, 4> {
+    typedef float T;
+    typedef vectorX<float, 4> V;
+    union {
+       __m128 s;
+       struct {
+           T r, g, b, a;
+       };
+    };
+    vectorX(T a_, T b, T c, T d = 1) : s(_mm_setr_ps(a_,b,c,d)) {
+    }
+    vectorX(__m128 s) : s(s) {
+    }
+    vectorX(const V &t) : s(t.s) {
+    }
+    V &operator *=(const T t) {
+       s = _mm_mul_ps(s, _mm_set1_ps(t));
+       return *this;
+    }
+    inline V operator *(const T t) const __attribute__((always_inline)) {
+       return V(*this) *= t;
+    };
+}
+__attribute__((aligned));
+typedef vectorX<real, 3> color3;
+typedef vectorX<real, 4> color4;
+typedef color3 color;
+static inline color4 c3to4(color c) {
+    color4 res(c.s);
+    res.a=1;
+    return res;
+}
+static inline color c4to3(color4 c) {
+    return color(c.s);
+}
+static inline color4 to_premultiplied(color c, real a) {
+    color4 res = c3to4(c);
+    return res * a;
+}
+static inline color4 to_premultiplied(color4 cs) {
+    return to_premultiplied(c4to3(cs), cs.a);
+}
+struct texture {
+};
+struct flat_texture : public texture {
+    color4 c;
+    flat_texture(const color4 &c) : c(to_premultiplied(c)) {
+    }
+};
+struct checkerboard_texture : public texture {
+    color4 even, odd;
+    checkerboard_texture(const color4 &even, const color4 &odd) : even(to_premultiplied(even)), odd(to_premultiplied(odd)) {
+    }
+};
+struct texture_placement {
+    texture *tex;
+};
+struct surface {
+    texture_placement textures[16];
+    size_t texcount;
+};
+struct primitive {
+    surface mat;
+};
+static void set_color(primitive *p, color4 c) {
+    p->mat.textures[0].tex = new flat_texture(c);
+}
+static primitive **checkerboard_scene(int *pi) {
+    primitive **prims = new primitive*[6];
+    set_color(prims[0], color4(.7,.7,.7));
+    prims[1]->mat.textures[prims[1]->mat.texcount++].tex = new checkerboard_texture(color4(1,.1,.1),color4(.1,.15,1));
+    set_color(prims[2], color4(.7,.9,.7));
+}
+int main (int argc, char * const argv[]) {
+    int primi;
+    primitive **prims = checkerboard_scene(&primi);
+}