This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix gimple_ic WRT EH


Hi,
this patch makes gimple_ic to purge dead EH when the direct call does not need it.

Bootstrapped/regtested x86_64-linux, will commit it shortly.
Honza
	PR ipa/65302
	* value-prof.c (gimple_ic): Pure dead eh edges when needed.
	* g++.dg/lto/pr65302_1.C: New testcase.
	* g++.dg/lto/pr65302_0.C: New testcase.
Index: value-prof.c
===================================================================
--- value-prof.c	(revision 221223)
+++ value-prof.c	(working copy)
@@ -1576,6 +1576,8 @@ gimple_ic (gcall *icall_stmt, struct cgr
 		     PHI_ARG_DEF_FROM_EDGE (phi, e_eh));
 	  }
        }
+  if (!stmt_could_throw_p (dcall_stmt))
+    gimple_purge_dead_eh_edges (dcall_bb);
   return dcall_stmt;
 }
 
Index: testsuite/g++.dg/lto/pr65302_1.C
===================================================================
--- testsuite/g++.dg/lto/pr65302_1.C	(revision 0)
+++ testsuite/g++.dg/lto/pr65302_1.C	(revision 0)
@@ -0,0 +1,83 @@
+#pragma implementation
+#pragma interface
+class CstringStorageReference {
+  public:
+  ~CstringStorageReference ();
+};
+class Cstring {
+  CstringStorageReference m_stringRef;
+ public:
+  Cstring (const char *str, int l = 0);
+  unsigned int getLength () const;
+};
+inline unsigned int
+Cstring::getLength () const { };
+class ZEvent_Component { };
+class ZEvent_Data { };
+class ZEvent_Interrupt { };
+class ZEvent_Mouse { };
+class ZEvent_Key { };
+class ZEventHandler
+{
+  virtual void HandleEvent (const ZEvent_Component & event);
+  virtual void HandleEvent (const ZEvent_Mouse & event);
+  virtual void HandleEvent (const ZEvent_Key & event);
+  virtual void HandleEvent (const ZEvent_Interrupt & event);
+  virtual void HandleEvent (const ZEvent_Data & event);
+};
+class ZColor { };
+class ZViewPort2D { };
+enum ZVerticalAlignment { VA_Baseline };
+struct ZDevicePointStruct { };
+class ZCursor;
+class ZPixmap;
+class Foo;
+class ZOutputDevice : public ZEventHandler {
+ public:
+  typedef ZVerticalAlignment TVerticalAlignment;
+  virtual const char *MyName () const { }
+  virtual ~ ZOutputDevice ();
+  virtual Cstring getTitle () const;
+  virtual void setTitle (const Cstring &) { }
+  virtual void Init ();
+  virtual void shutdown ();
+  virtual void minimize ();
+  virtual void normalize ();
+  virtual void raiseToTop ();
+  virtual ZViewPort2D GetViewPort () const;
+  virtual void setBackgroundColor (const ZColor & color) = 0;
+  virtual void Clear () = 0;
+  virtual void Flush (int forced) = 0;
+  virtual void dismissCache () { }
+  virtual int GetDeviceWidth () const = 0;
+  virtual int GetDeviceHeight () const = 0;
+  virtual Foo *CreateGraphicContext () = 0;
+  virtual ZCursor *createCursor (const ZPixmap &, int, int) { }
+  virtual void DrawLine (const Foo & gc, int x1, int y2) = 0;
+  virtual void DrawLines (const Foo & gc, const ZDevicePointStruct * points,
+			  unsigned int count) = 0;
+};
+class ZOutputDevicePS :public ZOutputDevice
+{
+  virtual void FillPolygon (const Foo & gc, unsigned int count);
+  virtual void DrawPoint (const Foo & gc, int x1, int y1);
+  virtual void DrawPoints (const Foo & gc, const ZDevicePointStruct * points,
+			   unsigned int count);
+  virtual void DrawRectangle (const Foo & gc, int x, int height);
+  virtual void DrawRectangles (const Foo & gc, unsigned int count);
+  virtual void FillRectangle (const Foo & gc, int x, int height);
+  virtual void FillRectangles (const Foo & gc, unsigned int count);
+  virtual void DrawCircle (const Foo & gc, int x, int y, int radius);
+  virtual void DrawCircles (const Foo & gc, unsigned int count);
+  virtual void FillCircle (const Foo & gc, int x, int y, int radius);
+  virtual void FillCircles (const Foo & gc, unsigned int count);
+  virtual void DrawString (const Foo & gc, int xx, int yy,
+			   TVerticalAlignment verAlign);
+  virtual void getStringBounds (const Foo & gc, const Cstring & theString,
+				int & width, int & height, int & acsent) const;
+};
+void
+ZOutputDevicePS::getStringBounds (const Foo &, const Cstring & theString,
+				   int & width, int & height, int & ascent) const {
+  width = theString.getLength () * 8;
+}
Index: testsuite/g++.dg/lto/pr65302_0.C
===================================================================
--- testsuite/g++.dg/lto/pr65302_0.C	(revision 0)
+++ testsuite/g++.dg/lto/pr65302_0.C	(revision 0)
@@ -0,0 +1,99 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -O2 } } }
+// { dg-extra-ld-options "-r -nostdlib -O0" }
+
+class CstringStorageReference {
+  public:
+  ~CstringStorageReference ();
+};
+class Cstring {
+  CstringStorageReference m_stringRef;
+ public:
+  Cstring (const char *str, int l = 0);
+  unsigned int getLength () const;
+};
+class ZEvent_Component { };
+class ZEvent_Data { };
+class ZEvent_Interrupt { };
+class ZEvent_Mouse { };
+class ZEvent_Key { };
+class ZEventHandler {
+  virtual void HandleEvent (const ZEvent_Component & event);
+  virtual void HandleEvent (const ZEvent_Mouse & event);
+  virtual void HandleEvent (const ZEvent_Key & event);
+  virtual void HandleEvent (const ZEvent_Interrupt & event);
+  virtual void HandleEvent (const ZEvent_Data & event);
+};
+enum ZHorizontalAlignment { HA_Left };
+enum ZVerticalAlignment { VA_Baseline };
+struct ZDevicePointStruct { };
+struct ZDeviceRectangleStruct { };
+struct ZDeviceCircleStruct { };
+class ZOutputDevice;
+class Foo;
+class ZRubberBand {
+ public:
+  ZOutputDevice * getOutputDevice ();
+};
+class ZRubberBand2P : public ZRubberBand {
+  virtual void Init ();
+  Foo *mp_graphicContext;
+  int m_textAscent;
+  int m_OkButtonWidth;
+  int m_OkButtonHeight;
+};
+class ZColor { };
+class ZViewPort2D { };
+class ZCursor;
+class ZPixmap;
+class ZOutputDevice:public ZEventHandler {
+public:
+  typedef ZHorizontalAlignment THorizontalAlignment;
+  typedef ZVerticalAlignment TVerticalAlignment;
+  virtual const char *MyName () const { return ""; }
+  virtual ~ ZOutputDevice ();
+  virtual Cstring getTitle () const;
+  virtual void setTitle (const Cstring &) { }
+  virtual void Init ();
+  virtual void shutdown ();
+  virtual void minimize ();
+  virtual void normalize ();
+  virtual void raiseToTop ();
+  virtual ZViewPort2D GetViewPort () const;
+  virtual void setBackgroundColor (const ZColor & color) = 0;
+  virtual void Clear () = 0;
+  virtual void Flush (int forced) = 0;
+  virtual void dismissCache () { }
+  virtual int GetDeviceWidth () const = 0;
+  virtual int GetDeviceHeight () const = 0;
+  virtual Foo *CreateGraphicContext () = 0;
+  virtual ZCursor *createCursor (const ZPixmap &, int, int) { return __null; }
+  virtual void DrawLine (const Foo & gc, int x1, int y1, int x2, int y2) = 0;
+  virtual void DrawLines (const Foo & gc, const ZDevicePointStruct * points, unsigned int count) = 0;
+  virtual void FillPolygon (const Foo & gc, const ZDevicePointStruct * points, unsigned int count) = 0;
+  virtual void DrawPoint (const Foo & gc, int x1, int y1) = 0;
+  virtual void DrawPoints (const Foo & gc, const ZDevicePointStruct * points, unsigned int count) = 0;
+  virtual void DrawRectangle (const Foo & gc, int x, int y, int width, int height) = 0;
+  virtual void DrawRectangles (const Foo & gc, const ZDeviceRectangleStruct * rectangles, unsigned int count) = 0;
+  virtual void FillRectangle (const Foo & gc, int x, int y, int width, int height) = 0;
+  virtual void FillRectangles (const Foo & gc, const ZDeviceRectangleStruct * rectangles, unsigned int count) = 0;
+  virtual void DrawCircle (const Foo & gc, int x, int y, int radius) = 0;
+  virtual void DrawCircles (const Foo & gc, const ZDeviceCircleStruct * circle, unsigned int count) = 0;
+  virtual void FillCircle (const Foo & gc, int x, int y, int radius) = 0;
+  virtual void FillCircles (const Foo & gc, const ZDeviceCircleStruct * circle, unsigned int count) = 0;
+  virtual void DrawString (const Foo & gc, int xx, int yy, const Cstring & theString, THorizontalAlignment horAlign = HA_Left, TVerticalAlignment verAlign = VA_Baseline) = 0;
+  virtual void getStringBounds (const Foo & gc, const Cstring & theString, int & width, int & height, int & ascent) const;
+};
+template < class T > class EMaskContentVector
+{
+  signed m_freelist_idx:32;
+  EMaskContentVector (const EMaskContentVector < T > &, void *buf);
+};
+template < class T > EMaskContentVector <
+  T >::EMaskContentVector (const EMaskContentVector < T > &elem, void *buf):
+m_freelist_idx (-1)
+{
+}
+void ZRubberBand2P::Init () {
+  getOutputDevice ()->getStringBounds (*mp_graphicContext, Cstring ("Ok"), m_OkButtonWidth, m_OkButtonHeight, m_textAscent);
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]