Drea Pinski (pinskia) <[email protected]> requested changes to the code:
> +++ gcc/rust/backend/rust-intrinsic-handlers.cc > @@ -752,0 +803,4 @@ > + auto return_statement > + = Backend::return_statement (fndecl, exchange_call, UNDEF_LOCATION); > + > + TREE_READONLY (exchange_call) = 0; build_call_array_loc call in Backend::call_expression will set TREE_READONLY/TREE_SIDE_EFFECTS if the fndecl is set correctly already. That is build_call_array_loc calls process_call_operands which then sets those. > +++ gcc/rust/rust-gcc.cc > @@ -2252,6 +2252,26 @@ function (tree functype, GGC::Ident name, > tl::optional<GGC::Ident> asm_name, > TREE_THIS_VOLATILE (decl) = 1; > if ((flags & function_in_unique_section) != 0) > resolve_unique_section (decl, 0, 1); > + if ((flags & function_is_public) != 0) Hmm, is it me or backend::function should only be called if you are creating a new fndecl. Seems like compile_intrinsic_function is calling backend::function is wrong. The normal builtins all should be created at startup not dynamically. Seems most of the places that call compile_intrinsic_function then check_for_cached_intrinsic before. And even more check_for_cached_intrinsic seems to be more than just a function decl; it is a whole expression. I don't get why this is done this way. Because you keep around a full expression which then gets copied (due to unshare) instead of rebuilt each time. The only thing that should be kept around is the function decl. This front-end is doing things very ineffiently. -- https://forge.sourceware.org/gcc/gcc-TEST/pulls/174#issuecomment-6294
