This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] PR rtl-optimization/32219: optimizer causees wrong code in pic/hidden/weak symbol checking
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Jack Howarth <howarth dot at dot gcc at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Mike Stump <mikestump at comcast dot net>, Iain Sandoe <iain at codesourcery dot com>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 12 Feb 2015 20:14:35 -0800
- Subject: Re: [PATCH] PR rtl-optimization/32219: optimizer causees wrong code in pic/hidden/weak symbol checking
- Authentication-results: sourceware.org; auth=none
- References: <20150206162314 dot GA12597 at intel dot com> <CAJMcOU9UbX=C2t=6X+DOTynkCurczbGNG3dqZRwjmRe8_U1fCg at mail dot gmail dot com> <CAMe9rOqHHZFHS4YMOAdN16aNyn4hi6eyzxGUrMue2uDn76ydGg at mail dot gmail dot com> <CAJMcOU9+x47s7jwRL4uniLs2z9EHR_Ajfk==HX1mObm97qytCg at mail dot gmail dot com> <CAMe9rOr5Ktk_yhfFX9DHAb6Sq=v2SORaY6TbahSiKF9dB1LNSQ at mail dot gmail dot com> <CAJMcOU-hPQYF1k58CXP4E5K2_-3F50RaMV_rHm3f5R_hXxivWQ at mail dot gmail dot com> <20150207122739 dot GA25185 at gmail dot com> <CAJMcOU-Bk1i9LeaHLpZGspWjDcY_n2qFcNgnCbbEsq30ZPTipA at mail dot gmail dot com> <20150207155606 dot GA14159 at gmail dot com> <20150207164507 dot GA19402 at gmail dot com> <54DA75D2 dot 40402 at redhat dot com> <54DC46BF dot 5060503 at redhat dot com> <CAMe9rOo+qukAAFFG=3xdu1z8GnX_k-ELY+=0Ym-f0YdfymTuYA at mail dot gmail dot com> <CAMe9rOrFdRqFXxw-ASFasb8M+UaaT4NNKrWUZ+D-CjpFGvOuNA at mail dot gmail dot com> <54DCFE10 dot 3050906 at redhat dot com> <CAMe9rOrzZdRx31rXyBKBDvcWvoDuC2ZKib6o=EW984prxq8=CQ at mail dot gmail dot com> <CAMe9rOry6GiysKXXFcsGFpJ6CJLFSGBoXociSeSYs5MvnuLUeg at mail dot gmail dot com> <54DD3FA9 dot 3010609 at redhat dot com>
On Thu, Feb 12, 2015 at 4:04 PM, Richard Henderson <firstname.lastname@example.org> wrote:
> On 02/12/2015 03:05 PM, H.J. Lu wrote:
>> @@ -6830,9 +6830,15 @@ default_binds_local_p_2 (const_tree exp, bool shlib, bool weak_dominate)
>> bool resolved_locally = false;
>> if (symtab_node *node = symtab_node::get (exp))
>> - /* When not building shared library and weak_dominate is true:
>> - weak, common or initialized symbols are resolved locally. */
>> - if ((weak_dominate && !shlib && node->definition)
>> + /* When weak_dominate is true and not building shared library or
>> + non-default visibility is specified by user: weak, common or
>> + initialized symbols are resolved locally.
>> + */
>> + if (((!shlib
>> + || (DECL_VISIBILITY_SPECIFIED (exp)
>> + && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT))
>> + && weak_dominate
>> + && node->definition)
>> || node->in_other_partition
>> || resolution_local_p (node->resolution))
>> resolved_locally = true;
> Hum. I don't find that particularly easy to reason with either.
> How about this? I'm about half-way through regression testing on it.
> I re-instated the use of resolution_to_local_definition_p, and attempt to infer
> a proper value for that when lto isn't in use. I use this to eliminate only
> undef-weak early, rather than non-dominate weak.
> I re-instated the use of the existence of the local definition in the
> DECL_VISIBILITY test. But unlike before, I reason that this allows us to
> eliminate the second visibility check. We either have an assertion from the
> user (SPECIFIED), or we know we have a definition. We no longer rely on the
> DECL_EXTERNAL test in the middle eliminating symbols without a definition.
> I shuffled some of the "return false" tests around among themselves, attempting
> to put the simplest test first. No change in behavior there.
> (First patch is delta from the 5-patch bundle; second patch is the
> composite from trunk, to avoid confusion.)
I tried the second patch. Results look good on Linux/x86-64.