https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96356

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
>From optimization POV (if we don't do that already), it would be nice to
optimize away after IPA comparisons the typeinfo comparisons, by making the
_ZT* symbols special (add some attribute them or whatever) and teaching the
middle-end the rules for those.

bool
foo ()
{
  return typeid (int) == typeid (long);
}

struct A { A (); virtual ~A (); };
struct B : public A {};

static inline bool
bar (A *p)
{
  return typeid (*p) == typeid (A);
}

bool
baz ()
{
  A a;
  return bar (&a);
}

bool
qux ()
{
  B a;
  return bar (&a);
}

Reply via email to