]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PR 68851] Do not collect thunks in collect_callers
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Dec 2015 13:07:15 +0000 (13:07 +0000)
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Dec 2015 13:07:15 +0000 (13:07 +0000)
2015-12-15  Martin Jambor  <mjambor@suse.cz>

PR ipa/68851
* cgraph.c (collect_callers_of_node_1): Do not collect thunks.
* cgraph.h (cgraph_node): Change comment of collect_callers.

testsuite/
* g++.dg/ipa/pr68851.C: New test.

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

gcc/ChangeLog
gcc/cgraph.c
gcc/cgraph.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr68851.C [new file with mode: 0644]

index e36f0ed603ec0586d8371edad3126181fd45b083..9b81b4818f235353b40d01eecfa0de453700d643 100644 (file)
@@ -1,3 +1,9 @@
+2015-12-15  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/68851
+       * cgraph.c (collect_callers_of_node_1): Do not collect thunks.
+       * cgraph.h (cgraph_node): Change comment of collect_callers.
+
 2015-12-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/66688
index c8c337026128c29c4ed49541ab02f38336e453c2..5a9c2a2d928f16421d4e1f730ed54dcdc912203a 100644 (file)
@@ -2592,7 +2592,8 @@ collect_callers_of_node_1 (cgraph_node *node, void *data)
 
   if (avail > AVAIL_INTERPOSABLE)
     for (cs = node->callers; cs != NULL; cs = cs->next_caller)
-      if (!cs->indirect_inlining_edge)
+      if (!cs->indirect_inlining_edge
+         && !cs->caller->thunk.thunk_p)
         redirect_callers->safe_push (cs);
   return false;
 }
index 0a093913be6447c0f81ff96f3cd17d0b2fc96921..ba14215ed6f1b0e88b004c12c851534be9704a2a 100644 (file)
@@ -1070,7 +1070,7 @@ public:
   cgraph_edge *get_edge (gimple *call_stmt);
 
   /* Collect all callers of cgraph_node and its aliases that are known to lead
-     to NODE (i.e. are not overwritable).  */
+     to NODE (i.e. are not overwritable) and that are not thunks.  */
   vec<cgraph_edge *> collect_callers (void);
 
   /* Remove all callers from the node.  */
index 4d749f1d1f26cfd44cd35d0bbadd3a6153780688..d08b40046e23889c34aaa39671e330117f915f10 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-15  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/68851
+       * g++.dg/ipa/pr68851.C: New test.
+
 2015-12-15  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/63506
diff --git a/gcc/testsuite/g++.dg/ipa/pr68851.C b/gcc/testsuite/g++.dg/ipa/pr68851.C
new file mode 100644 (file)
index 0000000..659e4cd
--- /dev/null
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-O3" }
+
+class A;
+class B {
+public:
+  operator A *() const;
+};
+class A {
+public:
+  virtual bool isFormControlElement() const {}
+};
+class C {
+  struct D {
+    B element;
+  };
+  bool checkPseudoClass(const D &, int &) const;
+};
+class F {
+  virtual bool isFormControlElement() const;
+};
+class G : A, F {
+  bool isFormControlElement() const {}
+};
+bool C::checkPseudoClass(const D &p1, int &) const {
+  A &a = *p1.element;
+  a.isFormControlElement();
+  a.isFormControlElement() || a.isFormControlElement();
+}