diff --git a/gcc/jit/jit-recording.h b/gcc/jit/jit-recording.h index 844dae37245ab..74c9f62184ad6 100644 --- a/gcc/jit/jit-recording.h +++ b/gcc/jit/jit-recording.h @@ -593,6 +593,14 @@ class type : public memento virtual bool is_same_type_as (type *other) { + if (is_int () + && other->is_int () + && get_size () == other->get_size () + && is_signed () == other->is_signed ()) + { + /* LHS (this) is an integer of the same size and sign as rtype. */ + return true; + } return this == other; } @@ -609,6 +617,7 @@ class type : public memento virtual type *is_volatile () { return NULL; } virtual type *is_restrict () { return NULL; } virtual type *is_const () { return NULL; } + virtual type *is_aligned () { return NULL; } virtual type *is_array () = 0; virtual struct_ *is_struct () { return NULL; } virtual bool is_union () const { return false; } @@ -672,13 +681,6 @@ class memento_of_get_type : public type accept it: */ return true; } - } else if (is_int () - && rtype->is_int () - && get_size () == rtype->get_size () - && is_signed () == rtype->is_signed ()) - { - /* LHS (this) is an integer of the same size and sign as rtype. */ - return true; } return type::accepts_writes_from (rtype); @@ -882,6 +884,18 @@ class memento_of_get_aligned : public decorated_type return result; } + bool is_same_type_as (type *other) final override + { + // TODO: check if outermost alignment is equal? + if (!other->is_aligned ()) + { + return m_other_type->is_same_type_as (other); + } + return m_other_type->is_same_type_as (other->is_aligned ()); + } + + type *is_aligned () final override { return m_other_type; } + /* Strip off the alignment, giving the underlying type. */ type *unqualified () final override { return m_other_type; }