Hi Martin,

> the following patch prevents the call speculation machinery from
> deallocating call graph edges from under the indirect inlining machinery
> and it also fixes a potential issue in speculation which could in some
> cases undo an earlier inlining decision, something that the inliner is
> not built to expect.
>
> That latter change requires disabling speculation on a testcase through
> adding -fno-profile-values, otherwise a devirtualziation happens before
> it is dump-scanned for.
>
> Bootstrapped and tested on an x86_64-linux, OK for trunk?
[...]
> 2019-07-25  Martin Jambor  <mjam...@suse.cz>
>
>       PR ipa/89330
>       * ipa-inline-transform.c (check_speculations_1): New function.
>       (push_all_edges_in_set_to_vec): Likewise.
>       (check_speculations): Use check_speculations_1, new parameter
>       new_edges.
>       (inline_call): Pass new_edges to check_speculations.
>       * ipa-inline.c (add_new_edges_to_heap): Assert edge_callee is not
>       NULL.
>       (speculation_useful_p): Early return true if edge is inlined, remove
>       later checks for inline_failed.
>
>       testsuite/
>       * g++.dg/lto/pr89330_[01].C: New test.

the new test FAILs on Solaris:

+FAIL: g++.dg/lto/pr89330 cp_lto_pr89330_0.o-cp_lto_pr89330_1.o link,  -O3 -g 
-flto -shared -Wno-odr 

Text relocation remains                         referenced
    against symbol                  offset      in file
Inkscape::XML::Node::root()         0x9c        cp_lto_pr89330_1.o
virtual thunk to Inkscape::XML::SimpleNode::name() const 0x6c           
cp_lto_pr89330_1.o
Inkscape::XML::Node::parent()       0xa4        cp_lto_pr89330_1.o
Inkscape::XML::Node::document() const 0x98              cp_lto_pr89330_1.o
Inkscape::XML::Node::next()         0xac        cp_lto_pr89330_1.o
[...]
Inkscape::XML::Node::code()         0x70        cp_lto_pr89330_1.o
Inkscape::XML::SimpleNode::name() const 0xc             cp_lto_pr89330_1.o
Inkscape::XML::Node::document()     0x94        cp_lto_pr89330_1.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: error: ld returned 1 exit status

This happens because ld defaults to -z text here and can easily be
avoided by compiling the code as PIC.

This is what the following patch does.  Tested on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu, installed on mainline.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-07-28  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * g++.dg/lto/pr89330_0.C (dg-lto-options): Add -fPIC.
        Require fpic support.

# HG changeset patch
# Parent  d121877e3d1d53929c62025b84c0a4a357901a96
Fix g++.dg/lto/pr89330 on Solaris

diff --git a/gcc/testsuite/g++.dg/lto/pr89330_0.C b/gcc/testsuite/g++.dg/lto/pr89330_0.C
--- a/gcc/testsuite/g++.dg/lto/pr89330_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr89330_0.C
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
-// { dg-lto-options { { -O3 -g -flto -shared -Wno-odr } } }
+// { dg-lto-options { { -O3 -g -flto -shared -fPIC -Wno-odr } } }
+// { dg-require-effective-target fpic }
 
 namespace Inkscape {
 class Anchored {};

Reply via email to