Commit b6dae849 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/79267 (internal compiler error with -O3 or -O2 -finline-functions)

	PR tree-optimization/79267
	* value-prof.c (gimple_ic): Only drop lhs for noreturn calls
	if should_remove_lhs_p is true.

	* g++.dg/opt/pr79267.C: New test.

From-SVN: r245053
parent 40fb9c89
2017-01-31 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79267
* value-prof.c (gimple_ic): Only drop lhs for noreturn calls
if should_remove_lhs_p is true.
2017-01-30 Alexandre Oliva <aoliva@redhat.com> 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
PR debug/63238 PR debug/63238
......
2017-01-31 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79267
* g++.dg/opt/pr79267.C: New test.
2017-01-30 Alexandre Oliva <aoliva@redhat.com> 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
PR debug/63238 PR debug/63238
......
// PR tree-optimization/79267
// { dg-do compile }
// { dg-options "-O3" }
struct A { A (int); };
struct B
{
virtual void av () = 0;
void aw ();
void h () { av (); aw (); }
};
template <class T> struct G : B
{
T ba;
G (int, T) : ba (0) {}
void av () { ba (0); }
};
struct I
{
B *bc;
template <class j, class T> I (j, T) try { G<T> (0, 0); } catch (...) {}
~I () { bc->h (); }
};
template <class M> struct C { typedef M *i; };
template <class M> struct J
{
J ();
template <class O, class T> J (O, T p2) : be (0, p2) {}
typename C<M>::i operator-> ();
I be;
};
struct H : A { H () : A (0) {} };
struct D { J<int> d; void q (); };
template <typename = int> class bs;
int z;
void
foo (int p1, int *, int)
{
if (p1 == 0)
throw H ();
}
D bar ();
template <typename T> struct L
{
struct K { K (int); void operator() (int *) { bar ().q (); } };
static J<T> bp () { bq (0); }
template <typename br> static void bq (br) { J<T> (0, K (0)); }
};
struct F
{
virtual J<int> x (int) { foo (0, 0, 0); J<bs<> > (L<bs<> >::bp ()); }
};
void
baz ()
{
if (z)
{
J<F> d, e;
d->x (0);
e->x (0);
}
J<F> v, i, j;
v->x (0);
i->x (0);
j->x (0);
}
...@@ -1358,7 +1358,8 @@ gimple_ic (gcall *icall_stmt, struct cgraph_node *direct_call, ...@@ -1358,7 +1358,8 @@ gimple_ic (gcall *icall_stmt, struct cgraph_node *direct_call,
dcall_stmt = as_a <gcall *> (gimple_copy (icall_stmt)); dcall_stmt = as_a <gcall *> (gimple_copy (icall_stmt));
gimple_call_set_fndecl (dcall_stmt, direct_call->decl); gimple_call_set_fndecl (dcall_stmt, direct_call->decl);
dflags = flags_from_decl_or_type (direct_call->decl); dflags = flags_from_decl_or_type (direct_call->decl);
if ((dflags & ECF_NORETURN) != 0) if ((dflags & ECF_NORETURN) != 0
&& should_remove_lhs_p (gimple_call_lhs (dcall_stmt)))
gimple_call_set_lhs (dcall_stmt, NULL_TREE); gimple_call_set_lhs (dcall_stmt, NULL_TREE);
gsi_insert_before (&gsi, dcall_stmt, GSI_SAME_STMT); gsi_insert_before (&gsi, dcall_stmt, GSI_SAME_STMT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment