There are enough calls to ssa_name_pt_solution now to warrant inlining
it. This requires value-range-storage.h to be included in a couple of
other places, and streamline the function itself.
Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed.
Andrew
* gimple.h: Include value-range-storage.h.
* tree-ssanames.cc (ssa_name_pt_solution): Move to...
* tree-ssanames.h (ssa_name_pt_solution): Here and adjust.
* tree-vrp.h: Include value-range-storage.h.
---
gcc/gimple.h | 1 +
gcc/tree-ssanames.cc | 9 ---------
gcc/tree-ssanames.h | 10 +++++++++-
gcc/tree-vrp.h | 1 +
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 0245e5e0934..f8f5b01ba85 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-expr.h"
#include "bitmap.h"
#include "value-range.h"
+#include "value-range-storage.h"
#include "value-query.h"
typedef gimple *gimple_seq_node;
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
index 8f6e922e007..c760d9370ad 100644
--- a/gcc/tree-ssanames.cc
+++ b/gcc/tree-ssanames.cc
@@ -140,15 +140,6 @@ get_pt_solution (tree name)
return pt;
}
-/* Return NAME's points-to solution, or NULL if none exists. */
-
-const pt_solution *
-ssa_name_pt_solution (const_tree name)
-{
- prange_storage *s = ssa_name_prange_storage (name);
- return s ? s->pt : NULL;
-}
-
/* Make PT the points-to solution for NAME. */
void
diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h
index 6ddf5d1fca5..78136871027 100644
--- a/gcc/tree-ssanames.h
+++ b/gcc/tree-ssanames.h
@@ -22,7 +22,15 @@ along with GCC; see the file COPYING3. If not see
/* Return NAME's points-to solution, or NULL if it has none. Returns
NULL
for a non pointer type. */
-extern const pt_solution *ssa_name_pt_solution (const_tree name);
+inline const pt_solution *
+ssa_name_pt_solution (const_tree name)
+{
+ vrange_storage *mem = SSA_NAME_RANGE_INFO (name);
+ if (!mem || mem->m_discriminator != VR_PRANGE)
+ return NULL;
+ prange_storage *s = static_cast <prange_storage *> (mem);
+ return s->pt;
+}
/* Make PT the points-to solution for NAME, which must have pointer
type. */
extern void set_ssa_name_pt_solution (tree name, const pt_solution &pt);
diff --git a/gcc/tree-vrp.h b/gcc/tree-vrp.h
index 2b88ba5230d..ce82c06eca4 100644
--- a/gcc/tree-vrp.h
+++ b/gcc/tree-vrp.h
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_TREE_VRP_H
#include "value-range.h"
+#include "value-range-storage.h"
extern int compare_values (tree, tree);
-- 2.56.0