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]

Re: [Bug c++/36185] [4.4 Regression] wrong code with -O2 -fgcse-sm


rguenth at gcc dot gnu dot org wrote:
------- Comment #3 from rguenth at gcc dot gnu dot org  2008-05-09 15:04 -------
Kenny, that's your PURE/CONST patch.


I am checking this in as obvious because given the frag from the first pure const patch, this is an obvious fix. I left out the '!' when I converted this conditional. (I also discussed this with Iant before i tested the fix).

The patch was tested on x86-64.

committed as revision 135185.

Kenny

@@ -5987,7 +5987,7 @@ store_killed_in_insn (const_rtx x, const
    {
      /* A normal or pure call might read from pattern,
     but a const call will not.  */
-      if (! CONST_OR_PURE_CALL_P (insn) || pure_call_p (insn))
+      if (RTL_CONST_CALL_P (insn))
    return true;

/* But even a const call reads its parameters. Check whether the



2008-05-10 Kenneth Zadeck <zadeck@naturalbridge.com>

* gcse.c (store_killed_in_insn): Negated call to RTL_CONST_CALL_P.
2008-05-10 Kenneth Zadeck <zadeck@naturalbridge.com>


   PR rtl-optimization/36185
   * g++.dg/opt/pr36185.C

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 135153)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2008-05-10  Kenneth Zadeck  <zadeck@naturalbridge.com>
+
+	* gcse.c (store_killed_in_insn): Negated call to RTL_CONST_CALL_P.
+		
 2008-05-10  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* config/i386/i386.c (bdesc_ptest): Removed.
Index: testsuite/g++.dg/opt/pr36185.C
===================================================================
--- testsuite/g++.dg/opt/pr36185.C	(revision 0)
+++ testsuite/g++.dg/opt/pr36185.C	(revision 0)
@@ -0,0 +1,24 @@
+// PR rtl-optimization/36185
+// { dg-do run }
+// { dg-options "-O2 -fgcse-sm" }
+
+struct Base {
+        virtual ~Base() {}
+        virtual void f() = 0;
+};
+struct Derived : Base {
+        Derived();
+        virtual void f() {}
+};
+struct Foo {
+        Foo(Base&);
+};
+Derived::Derived() {
+        Foo foo(*this);
+}
+Foo::Foo(Base& base) {
+        base.f();
+}
+int main() {
+        Derived d;
+}
Index: gcse.c
===================================================================
--- gcse.c	(revision 135153)
+++ gcse.c	(working copy)
@@ -5987,7 +5987,7 @@ store_killed_in_insn (const_rtx x, const
     {
       /* A normal or pure call might read from pattern,
 	 but a const call will not.  */
-      if (RTL_CONST_CALL_P (insn))
+      if (!RTL_CONST_CALL_P (insn))
 	return true;
 
       /* But even a const call reads its parameters.  Check whether the

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