+2013-12-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/59622
+ * gimple-fold.c (gimple_fold_call): Don't replace OBJ_TYPE_REF
+ call fndecl with 0 possible targets with BUILT_IN_UNREACHABLE,
+ instead only for !inplace add a __builtin_unreachable () call
+ before the call.
+
2013-12-31 Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Sergey Lega <sergey.s.lega@intel.com>
= possible_polymorphic_call_targets (callee, &final);
if (final && targets.length () <= 1)
{
- tree fndecl;
if (targets.length () == 1)
- fndecl = targets[0]->decl;
- else
- fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
- gimple_call_set_fndecl (stmt, fndecl);
- changed = true;
+ {
+ gimple_call_set_fndecl (stmt, targets[0]->decl);
+ changed = true;
+ }
+ else if (!inplace)
+ {
+ tree fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
+ gimple new_stmt = gimple_build_call (fndecl, 0);
+ gimple_set_location (new_stmt, gimple_location (stmt));
+ gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
+ return true;
+ }
}
}
}
+2013-12-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/59622
+ * g++.dg/opt/pr59622.C: New test.
+
2013-12-31 Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Sergey Lega <sergey.s.lega@intel.com>
--- /dev/null
+// PR tree-optimization/59622
+// { dg-do compile }
+// { dg-options "-O2" }
+
+namespace
+{
+ struct A
+ {
+ virtual int foo ();
+ int bar () { return foo (); }
+ };
+}
+
+int
+baz ()
+{
+ A a;
+ return a.bar ();
+}