Index: gcc/go/gccgo.texi =================================================================== --- gcc/go/gccgo.texi (revision 257312) +++ gcc/go/gccgo.texi (working copy) @@ -229,10 +229,10 @@ may be used. Or the checks may be remov by default, but in the future may be off by default on systems that do not require it. -@item -fgo-optimize-allocs -@cindex @option{-fgo-optimize-allocs} -Use escape analysis to allocate objects on the stack rather than the -heap when possible. In the future this may be the default. +@item -fno-go-optimize-allocs +@cindex @option{-fno-go-optimize-allocs} +Disable escape analysis, which tries to allocate objects on the stack +rather than the heap. @item -fgo-debug-escape@var{n} @cindex @option{-fgo-debug-escape} Index: gcc/go/go-c.h =================================================================== --- gcc/go/go-c.h (revision 257312) +++ gcc/go/go-c.h (working copy) @@ -29,7 +29,7 @@ class Backend; interface. */ extern int go_enable_dump (const char*); -extern int go_enable_optimize (const char*); +extern int go_enable_optimize (const char*, int); extern void go_add_search_path (const char*); Index: gcc/go/go-lang.c =================================================================== --- gcc/go/go-lang.c (revision 257312) +++ gcc/go/go-lang.c (working copy) @@ -194,7 +194,7 @@ static bool go_langhook_handle_option ( size_t scode, const char *arg, - int value ATTRIBUTE_UNUSED, + int value, int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) @@ -251,7 +251,7 @@ go_langhook_handle_option ( break; case OPT_fgo_optimize_: - ret = go_enable_optimize (arg) ? true : false; + ret = go_enable_optimize (arg, value) ? true : false; break; case OPT_fgo_pkgpath_: Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 257312) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -023c3d4358d101c71ac1436065690eaec2ce138e +e148068360699f24118950b728f23a5c98e1f85e The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/escape.cc =================================================================== --- gcc/go/gofrontend/escape.cc (revision 257312) +++ gcc/go/gofrontend/escape.cc (working copy) @@ -825,7 +825,7 @@ Escape_note::parse_tag(std::string* tag) // The -fgo-optimize-alloc flag activates this escape analysis. -Go_optimize optimize_allocation_flag("allocs"); +Go_optimize optimize_allocation_flag("allocs", true); // A helper function to compute whether a function name has a // matching hash value. Index: gcc/go/gofrontend/go-optimize.cc =================================================================== --- gcc/go/gofrontend/go-optimize.cc (revision 257312) +++ gcc/go/gofrontend/go-optimize.cc (working copy) @@ -19,8 +19,8 @@ Go_optimize* optimizations; // Create a new optimization. -Go_optimize::Go_optimize(const char* name) - : next_(optimizations), name_(name), is_enabled_(false) +Go_optimize::Go_optimize(const char* name, bool enabled) + : next_(optimizations), name_(name), is_enabled_(enabled) { optimizations = this; } @@ -28,7 +28,7 @@ Go_optimize::Go_optimize(const char* nam // Enable an optimization by name. bool -Go_optimize::enable_by_name(const char* name) +Go_optimize::enable_by_name(const char* name, bool value) { bool is_all = strcmp(name, "all") == 0; bool found = false; @@ -36,18 +36,18 @@ Go_optimize::enable_by_name(const char* { if (is_all || strcmp(name, p->name_) == 0) { - p->is_enabled_ = true; + p->is_enabled_ = value; found = true; } } return found; } -// Enable an optimization. Return 1 if this is a real name, 0 if not. +// Enable/disable an optimization. Return 1 if this is a real name, 0 if not. GO_EXTERN_C int -go_enable_optimize(const char* name) +go_enable_optimize(const char* name, int value) { - return Go_optimize::enable_by_name(name) ? 1 : 0; + return Go_optimize::enable_by_name(name, (bool)value) ? 1 : 0; } Index: gcc/go/gofrontend/go-optimize.h =================================================================== --- gcc/go/gofrontend/go-optimize.h (revision 257312) +++ gcc/go/gofrontend/go-optimize.h (working copy) @@ -15,16 +15,16 @@ class Go_optimize { public: - Go_optimize(const char* name); + Go_optimize(const char*, bool); // Whether this optimizaiton was enabled. bool is_enabled() const { return this->is_enabled_; } - // Enable an optimization by name. Return true if found. + // Enable/disable an optimization by name. Return true if found. static bool - enable_by_name(const char*); + enable_by_name(const char*, bool); private: // The next optimize flag. These are not in any order. Index: gcc/go/lang.opt =================================================================== --- gcc/go/lang.opt (revision 257312) +++ gcc/go/lang.opt (working copy) @@ -58,7 +58,7 @@ Go Joined RejectNegative -fgo-dump- Dump Go frontend internal information. fgo-optimize- -Go Joined RejectNegative +Go Joined -fgo-optimize- Turn on optimization passes in the frontend. fgo-pkgpath=