]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ipa-ref.c
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / ipa-ref.c
index f9af352f2f938ba153e356614fb65ab0b0d87af5..0493acfd7c9c7442a49887568c21a90e74f23d14 100644 (file)
@@ -1,5 +1,5 @@
 /* Interprocedural reference lists.
-   Copyright (C) 2010-2015 Free Software Foundation, Inc.
+   Copyright (C) 2010-2021 Free Software Foundation, Inc.
    Contributed by Jan Hubicka
 
 This file is part of GCC.
@@ -21,30 +21,9 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "vec.h"
-#include "double-int.h"
-#include "input.h"
-#include "alias.h"
-#include "symtab.h"
-#include "options.h"
-#include "wide-int.h"
-#include "inchash.h"
-#include "tree.h"
-#include "fold-const.h"
-#include "ggc.h"
 #include "target.h"
-#include "hash-map.h"
-#include "is-a.h"
-#include "plugin-api.h"
-#include "tm.h"
-#include "hard-reg-set.h"
-#include "input.h"
-#include "function.h"
-#include "ipa-ref.h"
+#include "tree.h"
 #include "cgraph.h"
-#include "ipa-utils.h"
 
 /* Remove reference.  */
 
@@ -53,7 +32,6 @@ ipa_ref::remove_reference ()
 {
   struct ipa_ref_list *list = referred_ref_list ();
   struct ipa_ref_list *list2 = referring_ref_list ();
-  vec<ipa_ref_t, va_gc> *old_references = list2->references;
   struct ipa_ref *last;
 
   gcc_assert (list->referring[referred_index] == this);
@@ -87,7 +65,7 @@ ipa_ref::remove_reference ()
     }
   list->referring.pop ();
 
-  last = &list2->references->last ();
+  last = &list2->references.last ();
 
   struct ipa_ref *ref = this;
 
@@ -96,8 +74,7 @@ ipa_ref::remove_reference ()
       *ref = *last;
       ref->referred_ref_list ()->referring[referred_index] = ref;
     }
-  list2->references->pop ();
-  gcc_assert (list2->references == old_references);
+  list2->references.pop ();
 }
 
 /* Return true when execution of reference can lead to return from
@@ -124,23 +101,3 @@ ipa_ref::referred_ref_list (void)
 {
   return &referred->ref_list;
 }
-
-/* Return true if refernece may be used in address compare.  */
-bool
-ipa_ref::address_matters_p ()
-{
-  if (use != IPA_REF_ADDR)
-    return false;
-  /* Addresses taken from virtual tables are never compared.  */
-  if (is_a <varpool_node *> (referring)
-      && DECL_VIRTUAL_P (referring->decl))
-    return false;
-  /* Address of virtual tables and functions is never compared.  */
-  if (DECL_VIRTUAL_P (referred->decl))
-    return false;
-  /* Address of C++ cdtors is never compared.  */
-  if (is_a <cgraph_node *> (referred)
-      && (DECL_CXX_CONSTRUCTOR_P (referred->decl) || DECL_CXX_DESTRUCTOR_P (referred->decl)))
-    return false;
-  return true;
-}