On 8/7/20 8:33 PM, Jakub Jelinek wrote:
On Fri, Aug 07, 2020 at 08:04:57PM +0200, Aldy Hernandez wrote:
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -82,7 +82,6 @@ along with GCC; see the file COPYING3.  If not see
  #include "gimplify.h"
  #include "stringpool.h"
  #include "attribs.h"
-#include <vector>
  #include "tree-into-ssa.h"

This part won't apply (Gerald has changed it to #define INCLUDE_VECTOR
earlier I think).

--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1281,7 +1281,10 @@ template<typename T, typename A>
  inline size_t
  vec<T, A, vl_embed>::embedded_size (unsigned alloc)
  {
-  typedef vec<T, A, vl_embed> vec_embedded;
+  struct alignas (T) U { char data[sizeof (T)]; };
+  typedef vec<U, A, vl_embed> vec_embedded;
+  static_assert(sizeof(vec_embedded) == sizeof(vec), "");
+  static_assert(alignof(vec_embedded) == alignof(vec), "");

s/(/ (/g on the above two lines please (GCC vs. libstdc++ coding
style differences).

I think it would be nice to see e.g. in -fdump-tree-gimple dump
on ipa-fnsummary.c what value_range ctors does it call for the auto_vec and
if that is what we want, other than that LGTM.

I see the following in the dump:

evaluate_properties_for_edge()
{
...
  struct auto_vec known_value_ranges;
...
  try
    {
...
      auto_vec<int_range<1>, 32>::auto_vec (&known_value_ranges);
...

It looks like the auto_vec constructor is calling the int_range<1> constructor correctly:

auto_vec<int_range<1>, 32>::auto_vec (struct auto_vec * const this)
{
...
    int_range<1>::int_range (D.130911);


The int_range<1> constructor also looks correct:

int_range<1>::int_range (struct int_range * const this, const struct int_range & other)
{
  *this = {CLOBBER};
  {
    _1 = &this->D.92184;
    _2 = &this->m_ranges;
    irange::irange (_1, _2, 1);
    _3 = &this->D.92184;
    _4 = &other->D.92184;
    irange::operator= (_3, _4);
  }
}

If y'all agree, I will push the patch with Jakub's suggested changes.

Aldy

Reply via email to