This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [google][4.8] Expose all target specific builtins unconditionally for LIPO builds
- From: Xinliang David Li <davidxl at google dot com>
- To: Sriraman Tallam <tmsriram at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 24 Jul 2013 15:21:29 -0700
- Subject: Re: [google][4.8] Expose all target specific builtins unconditionally for LIPO builds
- References: <CAAs8Hmz-_Hf8KFSLYO4OppjkVVLeAWU1qmnOF=C=dsXpXfEaPw at mail dot gmail dot com>
Can you collect some number on ggc_memory increase with this change
in profile_gen build -- the value is recorded gcov_module_info object
in coverage.c.
thanks,
David
On Wed, Jul 24, 2013 at 3:14 PM, Sriraman Tallam <tmsriram@google.com> wrote:
> The following test-case fails in LIPO mode during profile-use build:
>
> main.cc
> ------------
> __attribute__((target("sse4.2")))
> unsigned int problem_aux (unsigned int A, unsigned int B);
>
>
> int main (int argc, char *argv[])
> {
> return problem_aux (0, 0);
> }
>
> aux.cc
> ---------
> __attribute__((target("sse4.2")))
> unsigned int problem_aux (unsigned int A, unsigned int B)
> {
> return __builtin_ia32_crc32qi (A, B);
> }
>
> $ g++ -O2 -fprofile-generate main.cc aux.cc
> $ ./a.out
> $ g++ -O2 -fprofile-use main.cc
> error: '__builtin_ia32_crc32qi' was not declared in this scope
>
> This happens when parsing the auxiliary module. __builtin_ia32_crc32qi
> is a target specific builtin that gets created after the target
> attribute is seen in the declaration of problem_aux in the primary
> module. This is too late for adding theisbuiltin to the list of
> knowns, the buitlins get saved when cp_save_built_in_decl_pre_parsing
> in cp/cp-objcp-common.c is called much earlier. Hence, this builtin
> which is created during primary module parsing is not available when
> parsing the auxiliary module.
>
> A simple fix is to expose all target builtins unconditionally in LIPO
> mode. Patch:
>
>
> Index: config/i386/i386.c
> ===================================================================
> --- config/i386/i386.c (revision 201046)
> +++ config/i386/i386.c (working copy)
> @@ -26957,7 +26957,8 @@ def_builtin (HOST_WIDE_INT mask, const char *name,
> ix86_builtins_isa[(int) code].isa = mask;
>
> mask &= ~OPTION_MASK_ISA_64BIT;
> - if (mask == 0
> + if (flag_dyn_ipa
> + || mask == 0
> || (mask & ix86_isa_flags) != 0
> || (lang_hooks.builtin_function
> == lang_hooks.builtin_function_ext_scope))
>
>
> Is this ok?
>
> Thanks
> Sri