[Bug tree-optimization/98925] New: Extend modref to handle return slot optimization
slyfox at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 1 18:37:46 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98925
Bug ID: 98925
Summary: Extend modref to handle return slot optimization
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: hubicka at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
CC: rguenth at gcc dot gnu.org
Target Milestone: ---
Moving out https://gcc.gnu.org/PR98499#c9 to a separate enhancement PR:
Right now analyze_ssa_name_flags() does not perform detailed modref analysis of
return slot optimization and falls back to conservative assumption:
analyze_ssa_name_flags()
/* Return slot optiomization would require bit of propagation;
give up for now. */
if (gimple_call_return_slot_opt_p (call)
&& gimple_call_lhs (call) != NULL_TREE
&& TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (call))))
{
if (dump_file)
fprintf (dump_file, "%*s Unhandled return slot opt\n",
depth * 4, "");
lattice[index].merge (0);
}
I don't know what would be a good test for it.
If I don't overstimate modref and alias analysis destructor should disappear
completely in the example below (from https://gcc.gnu.org/PR98499#c4):
struct string {
char * _M_buf;
// local store
char _M_local_buf[16];
__attribute__((noinline)) string() : _M_buf(_M_local_buf) {}
~string() {
if (_M_buf != _M_local_buf)
__builtin_trap();
}
string(const string &__str); // no copies
};
// main.cc
__attribute__((noinline)) static string dir_name() { return string(); }
class Importer {
string base_path;
public:
__attribute__((noinline)) Importer() : base_path (dir_name()) {}
};
int main() {
Importer imp;
}
More information about the Gcc-bugs
mailing list