Merge tag 'go1.12.5' into HEAD

Change-Id: I7fe9cd66c8b2c196054e81e3a8c07de36fd76839
diff --git a/AUTHORS b/AUTHORS
index 8001484..8b8105b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -418,7 +418,7 @@
 Elbert Fliek <efliek@gmail.com>
 Eldar Rakhimberdin <ibeono@gmail.com>
 Elena Grahovac <elena@grahovac.me>
-Elias Naur <elias.naur@gmail.com>
+Elias Naur <mail@eliasnaur.com> <elias.naur@gmail.com>
 Elliot Morrison-Reed <elliotmr@gmail.com>
 Emerson Lin <linyintor@gmail.com>
 Emil Hessman <emil@hessman.se>
@@ -1304,6 +1304,7 @@
 Sylvain Zimmer <sylvain@sylvainzimmer.com>
 Syohei YOSHIDA <syohex@gmail.com>
 Szabolcs Nagy <nsz@port70.net>
+Taavi Kivisik <taavi.kivisik@gmail.com>
 Tad Fisher <tadfisher@gmail.com>
 Tad Glines <tad.glines@gmail.com>
 Taj Khattra <taj.khattra@gmail.com>
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index f6a0df1..b201301 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -25,6 +25,7 @@
 # Please keep the list sorted.
 
 Aamir Khan <syst3m.w0rm@gmail.com>
+Aaron Cannon <cannona@fireantproductions.com>
 Aaron France <aaron.l.france@gmail.com>
 Aaron Jacobs <jacobsa@google.com>
 Aaron Kemp <kemp.aaron@gmail.com>
@@ -188,6 +189,7 @@
 Andy Lindeman <andy@lindeman.io>
 Andy Maloney <asmaloney@gmail.com>
 Andy Walker <walkeraj@gmail.com>
+Andzej Maciusovic <andzej.maciusovic@gmail.com>
 Anfernee Yongkun Gui <anfernee.gui@gmail.com>
 Angelo Bulfone <mbulfone@gmail.com>
 Anh Hai Trinh <anh.hai.trinh@gmail.com>
@@ -553,6 +555,7 @@
 Donovan Hide <donovanhide@gmail.com>
 Doug Anderson <douga@google.com>
 Doug Fawley <dfawley@google.com>
+Douglas Danger Manley <doug.manley@gmail.com>
 Drew Flower <drewvanstone@gmail.com>
 Drew Hintz <adhintz@google.com>
 Duncan Holm <mail@frou.org>
@@ -575,7 +578,7 @@
 Elbert Fliek <efliek@gmail.com>
 Eldar Rakhimberdin <ibeono@gmail.com>
 Elena Grahovac <elena@grahovac.me>
-Elias Naur <elias.naur@gmail.com>
+Elias Naur <mail@eliasnaur.com> <elias.naur@gmail.com>
 Elliot Morrison-Reed <elliotmr@gmail.com>
 Emerson Lin <linyintor@gmail.com>
 Emil Hessman <emil@hessman.se>
@@ -633,6 +636,7 @@
 Fatih Arslan <fatih@arslan.io>
 Fazal Majid <majid@apsalar.com>
 Fazlul Shahriar <fshahriar@gmail.com>
+Federico Bond <federicobond@gmail.com>
 Federico Simoncelli <fsimonce@redhat.com>
 Fedor Indutny <fedor@indutny.com>
 Felipe Oliveira <felipeweb.programador@gmail.com>
@@ -661,6 +665,7 @@
 Fredrik Enestad <fredrik.enestad@soundtrackyourbrand.com>
 Fredrik Forsmo <fredrik.forsmo@gmail.com>
 Fredrik Wallgren <fredrik.wallgren@gmail.com>
+Frew Schmidt <github@frew.co>
 Frithjof Schulze <schulze@math.uni-hannover.de> <sfrithjof@gmail.com>
 Frits van Bommel <fvbommel@gmail.com>
 Fumitoshi Ukai <ukai@google.com>
@@ -714,8 +719,9 @@
 GitHub User @OlgaVlPetrova (44112727) <OVPpetrova@gmail.com>
 GitHub User @pityonline (438222) <pityonline@gmail.com>
 GitHub User @pytimer (17105586) <lixin20101023@gmail.com>
+GitHub User @saitarunreddy (21041941) <saitarunreddypalla@gmail.com>
 GitHub User @shogo-ma (9860598) <Choroma194@gmail.com>
-GitHub User @tkivisik (13732144) <taavi.kivisik@gmail.com>
+GitHub User @tell-k (26263) <ffk2005@gmail.com>
 GitHub User @uhei (2116845) <uhei@users.noreply.github.com>
 GitHub User @uropek (39370426) <uropek@gmail.com>
 Giulio Iotti <dullgiulio@gmail.com>
@@ -733,6 +739,7 @@
 Greg Ward <greg@gerg.ca>
 Grégoire Delattre <gregoire.delattre@gmail.com>
 Gregory Man <man.gregory@gmail.com>
+Guilherme Caruso <gui.martinscaruso@gmail.com>
 Guilherme Garnier <guilherme.garnier@gmail.com>
 Guilherme Goncalves <guilhermeaugustosg@gmail.com>
 Guilherme Rezende <guilhermebr@gmail.com>
@@ -895,6 +902,7 @@
 Javier Kohen <jkohen@google.com>
 Javier Segura <javism@gmail.com>
 Jay Conrod <jayconrod@google.com>
+Jay Taylor <outtatime@gmail.com>
 Jay Weisskopf <jay@jayschwa.net>
 Jean de Klerk <deklerk@google.com>
 Jean-André Santoni <jean.andre.santoni@gmail.com>
@@ -1020,6 +1028,7 @@
 JP Sugarbroad <jpsugar@google.com>
 JT Olds <jtolds@xnet5.com>
 Juan Carlos <juanjcsr@gmail.com>
+Juan Pablo Civile <elementohb@gmail.com>
 Jude Pereira <judebpereira@gmail.com>
 Jukka-Pekka Kekkonen <karatepekka@gmail.com>
 Julia Hansbrough <flowerhack@google.com>
@@ -1027,6 +1036,7 @@
 Julian Pastarmov <pastarmovj@google.com>
 Julian Phillips <julian@quantumfyre.co.uk>
 Julie Qiu <julie@golang.org>
+Julien Kauffmann <julien.kauffmann@freelan.org>
 Julien Salleyron <julien.salleyron@gmail.com>
 Julien Schmidt <google@julienschmidt.com>
 Julio Montes <julio.montes@intel.com>
@@ -1282,6 +1292,7 @@
 Maxime de Roucy <maxime.deroucy@gmail.com>
 Máximo Cuadros Ortiz <mcuadros@gmail.com>
 Maxwell Krohn <themax@gmail.com>
+Maya Rashish <maya@NetBSD.org>
 Mayank Kumar <krmayankk@gmail.com>
 Meir Fischer <meirfischer@gmail.com>
 Meng Zhuo <mengzhuo1203@gmail.com>
@@ -1458,6 +1469,7 @@
 Paolo Giarrusso <p.giarrusso@gmail.com>
 Paolo Martini <mrtnpaolo@gmail.com>
 Parker Moore <parkrmoore@gmail.com>
+Parminder Singh <parmsingh101@gmail.com>
 Pascal S. de Kloe <pascal@quies.net>
 Pat Moroney <pat@pat.email>
 Patrick Crosby <patrick@stathat.com>
@@ -1504,6 +1516,7 @@
 Peter Bourgon <peter@bourgon.org>
 Peter Collingbourne <pcc@google.com>
 Peter Conerly <pconerly@gmail.com>
+Peter Dotchev <dotchev@gmail.com>
 Peter Froehlich <peter.hans.froehlich@gmail.com>
 Peter Gonda <pgonda@google.com>
 Peter Hoyes <pahoyes@gmail.com>
@@ -1554,6 +1567,7 @@
 Quentin Renard <contact@asticode.com>
 Quentin Smith <quentin@golang.org>
 Quinn Slack <sqs@sourcegraph.com>
+Quinten Yearsley <qyearsley@chromium.org>
 Quoc-Viet Nguyen <afelion@gmail.com>
 Radek Sohlich <sohlich@gmail.com>
 Radu Berinde <radu@cockroachlabs.com>
@@ -1627,6 +1641,7 @@
 Ron Minnich <rminnich@gmail.com>
 Ross Chater <rdchater@gmail.com>
 Ross Light <light@google.com> <rlight2@gmail.com>
+Ross Smith II <ross@smithii.com>
 Rowan Marshall <rowanajmarshall@gmail.com>
 Rowan Worth <sqweek@gmail.com>
 Rudi Kramer <rudi.kramer@gmail.com>
@@ -1681,13 +1696,17 @@
 Scott Schwartz <scotts@golang.org>
 Scott Van Woudenberg <scottvw@google.com>
 Sean Burford <sburford@google.com>
+Sean Chen <oohcode@gmail.com>
 Sean Chittenden <seanc@joyent.com>
 Sean Christopherson <sean.j.christopherson@intel.com>
 Sean Dolphin <Sean.Dolphin@kpcompass.com>
 Sean Harger <sharger@google.com>
 Sean Rees <sean@erifax.org>
+Sebastiaan van Stijn <github@gone.nl>
+Sebastian Schmidt <yath@google.com>
 Sebastien Binet <seb.binet@gmail.com>
 Sébastien Paolacci <sebastien.paolacci@gmail.com>
+Sebastien Williams-Wynn <sebastien@cytora.com>
 Seiji Takahashi <timaki.st@gmail.com>
 Sergei Skorobogatov <skorobo@rambler.ru>
 Sergey 'SnakE' Gromov <snake.scaly@gmail.com>
@@ -1773,6 +1792,7 @@
 Sylvain Zimmer <sylvain@sylvainzimmer.com>
 Syohei YOSHIDA <syohex@gmail.com>
 Szabolcs Nagy <nsz@port70.net>
+Taavi Kivisik <taavi.kivisik@gmail.com>
 Tad Fisher <tadfisher@gmail.com>
 Tad Glines <tad.glines@gmail.com>
 Tadas Valiukas <tadovas@gmail.com>
@@ -1889,6 +1909,7 @@
 Vega Garcia Luis Alfonso <vegacom@gmail.com>
 Venil Noronha <veniln@vmware.com>
 Veselkov Konstantin <kostozyb@gmail.com>
+Viacheslav Poturaev <vearutop@gmail.com>
 Victor Chudnovsky <vchudnov@google.com>
 Victor Vrantchan <vrancean+github@gmail.com>
 Vignesh Ramachandra <vickyramachandra@gmail.com>
@@ -1962,6 +1983,7 @@
 Yesudeep Mangalapilly <yesudeep@google.com>
 Yissakhar Z. Beck <yissakhar.beck@gmail.com>
 Yo-An Lin <yoanlin93@gmail.com>
+Yohei Takeda <yo.tak0812@gmail.com>
 Yongjian Xu <i3dmaster@gmail.com>
 Yorman Arias <cixtords@gmail.com>
 Yoshiyuki Kanno <nekotaroh@gmail.com> <yoshiyuki.kanno@stoic.co.jp>
diff --git a/VERSION b/VERSION
index 11c4f59..47fe908 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-go1.11.1
\ No newline at end of file
+go1.12.5
diff --git a/doc/cmd.html b/doc/cmd.html
index c590f4d..e306847 100644
--- a/doc/cmd.html
+++ b/doc/cmd.html
@@ -18,10 +18,8 @@
 
 <p>
 The programs can also be run as stand-alone binaries, with unmodified arguments,
-using the go <code>tool</code> subcommand, such as <code>go tool vet</code>.
-This style of invocation allows, for instance, checking a single source file
-rather than an entire package: <code>go tool vet myprogram.go</code> as
-compared to <code>go vet mypackage</code>.
+using the go <code>tool</code> subcommand, such as <code>go tool cgo</code>.
+For most commands this is mainly useful for debugging.
 Some of the commands, such as <code>pprof</code>, are accessible only through
 the go <code>tool</code> subcommand.
 </p>
@@ -76,7 +74,7 @@
 </tr>
 
 <tr>
-<td><a href="/cmd/go/">fmt</a></td>
+<td><a href="/cmd/gofmt/">fmt</a></td>
 <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
 <td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
 gofmt</a> command with more general options.</td>
diff --git a/doc/codewalk/codewalk.js b/doc/codewalk/codewalk.js
index abc5937..4f59a8f 100644
--- a/doc/codewalk/codewalk.js
+++ b/doc/codewalk/codewalk.js
@@ -276,7 +276,7 @@
   }
 
   // Force original file even if user hasn't changed comments since they may
-  // have nagivated away from it within the iframe without us knowing.
+  // have navigated away from it within the iframe without us knowing.
   this.navigateToCode(currentFile);
 };
 
diff --git a/doc/contrib.html b/doc/contrib.html
index b4b19a6..fc853a9 100644
--- a/doc/contrib.html
+++ b/doc/contrib.html
@@ -34,6 +34,7 @@
 <p>A <a href="/doc/devel/release.html">summary</a> of the changes between Go releases. Notes for the major releases:</p>
 
 <ul>
+	<li><a href="/doc/go1.12">Go 1.12</a> <small>(February 2019)</small></li>
 	<li><a href="/doc/go1.11">Go 1.11</a> <small>(August 2018)</small></li>
 	<li><a href="/doc/go1.10">Go 1.10</a> <small>(February 2018)</small></li>
 	<li><a href="/doc/go1.9">Go 1.9</a> <small>(August 2017)</small></li>
diff --git a/doc/contribute.html b/doc/contribute.html
index 68b2387..6f2287b 100644
--- a/doc/contribute.html
+++ b/doc/contribute.html
@@ -46,7 +46,8 @@
 <li>
 <b>Step 2</b>: Configure authentication credentials for the Go Git repository.
 Visit <a href="https://go.googlesource.com/">go.googlesource.com</a>, click
-on "Generate Password" (top right), and follow the instructions.
+on the gear icon (top right), then on "Obtain password", and follow the
+instructions.
 </li>
 <li>
 <b>Step 3</b>: Register for Gerrit, the code review tool used by the Go team,
diff --git a/doc/debugging_with_gdb.html b/doc/debugging_with_gdb.html
index fd2c831..3899ac9 100644
--- a/doc/debugging_with_gdb.html
+++ b/doc/debugging_with_gdb.html
@@ -256,7 +256,7 @@
 </pre>
 
 <p>
-List a specific part of the source parametrizing <code>"list"</code> with a
+List a specific part of the source parameterizing <code>"list"</code> with a
 function name (it must be qualified with its package name).
 </p>
 
diff --git a/doc/devel/release.html b/doc/devel/release.html
index 73f7a0e..69eec33 100644
--- a/doc/devel/release.html
+++ b/doc/devel/release.html
@@ -23,6 +23,52 @@
 (for example, Go 1.6.1, Go 1.6.2, and so on).
 </p>
 
+<h2 id="go1.12">go1.12 (released 2019/02/25)</h2>
+
+<p>
+Go 1.12 is a major release of Go.
+Read the <a href="/doc/go1.12">Go 1.12 Release Notes</a> for more information.
+</p>
+
+<h3 id="go1.12.minor">Minor revisions</h3>
+
+<p>
+go1.12.1 (released 2019/03/14) includes fixes to cgo, the compiler, the go
+command, and the <code>fmt</code>, <code>net/smtp</code>, <code>os</code>,
+<code>path/filepath</code>, <code>sync</code>, and <code>text/template</code>
+packages. See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.1">Go
+1.12.1 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.12.2 (released 2019/04/05) includes fixes to the compiler, the go
+command, the runtime, and the <code>doc</code>, <code>net</code>,
+<code>net/http/httputil</code>, and <code>os</code> packages. See the
+<a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.2">Go
+1.12.2 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.12.3 (released 2019/04/08) was accidentally released without its
+intended fix. It is identical to go1.12.2, except for its version
+number. The intended fix is in go1.12.4.
+</p>
+
+<p>
+go1.12.4 (released 2019/04/11) fixes an issue where using the prebuilt binary
+releases on older versions of GNU/Linux
+<a href="https://golang.org/issues/31293">led to failures</a>
+when linking programs that used cgo.
+Only Linux users who hit this issue need to update.
+</p>
+
+<p>
+go1.12.5 (released 2019/05/06) includes fixes to the compiler, the linker,
+the go command, the runtime, and the <code>os</code> package. See the
+<a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.5">Go
+1.12.5 milestone</a> on our issue tracker for details.
+</p>
+
 <h2 id="go1.11">go1.11 (released 2018/08/24)</h2>
 
 <p>
@@ -66,6 +112,48 @@
 1.11.4 milestone</a> on our issue tracker for details.
 </p>
 
+<p>
+go1.11.5 (released 2019/01/23) includes a security fix to the
+<code>crypto/elliptic</code> package.  See
+the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.5">Go
+1.11.5 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.6 (released 2019/03/14) includes fixes to cgo, the compiler, linker,
+runtime, go command, and the <code>crypto/x509</code>, <code>encoding/json</code>,
+<code>net</code>, and <code>net/url</code> packages. See the
+<a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.6">Go
+1.11.6 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.7 (released 2019/04/05) includes fixes to the runtime and the
+<code>net</code> packages. See the
+<a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.7">Go
+1.11.7 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.8 (released 2019/04/08) was accidentally released without its
+intended fix. It is identical to go1.11.7, except for its version
+number. The intended fix is in go1.11.9.
+</p>
+
+<p>
+go1.11.9 (released 2019/04/11) fixes an issue where using the prebuilt binary
+releases on older versions of GNU/Linux
+<a href="https://golang.org/issues/31293">led to failures</a>
+when linking programs that used cgo.
+Only Linux users who hit this issue need to update.
+</p>
+
+<p>
+go1.11.10 (released 2019/05/06) includes fixes to the runtime and the linker.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.10">Go
+1.11.10 milestone</a> on our issue tracker for details.
+</p>
+
 <h2 id="go1.10">go1.10 (released 2018/02/16)</h2>
 
 <p>
@@ -131,6 +219,13 @@
 Go 1.10.7 milestone</a> on our issue tracker for details.
 </p>
 
+<p>
+go1.10.8 (released 2019/01/23) includes a security fix to the
+<code>crypto/elliptic</code> package.  See
+the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.10.8">Go
+1.10.8 milestone</a> on our issue tracker for details.
+</p>
+
 <h2 id="go1.9">go1.9 (released 2017/08/24)</h2>
 
 <p>
diff --git a/doc/go1.12.html b/doc/go1.12.html
index 568920d..cc19c0f 100644
--- a/doc/go1.12.html
+++ b/doc/go1.12.html
@@ -15,14 +15,7 @@
   ul li { margin: 0.5em 0; }
 </style>
 
-<h2 id="introduction">DRAFT RELEASE NOTES - Introduction to Go 1.12</h2>
-
-<p>
-  <strong>
-    Go 1.12 is not yet released. These are work-in-progress
-    release notes. Go 1.12 is expected to be released in February 2019.
-  </strong>
-</p>
+<h2 id="introduction">Introduction to Go 1.12</h2>
 
 <p>
   The latest Go release, version 1.12, arrives six months after <a href="go1.11">Go 1.11</a>.
@@ -47,6 +40,7 @@
   Go 1.12 is the last release that is supported on FreeBSD 10.x, which has
   already reached end-of-life. Go 1.13 will require FreeBSD 11.2+ or FreeBSD
   12.0+.
+  FreeBSD 12.0+ requires a kernel with the COMPAT_FREEBSD11 option set (this is the default).
 </p>
 
 <p><!-- CL 146898 -->
@@ -108,11 +102,23 @@
   is no longer available with <code>go vet</code>. Checking for
   variable shadowing may now be done using
 <pre>
-go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
+go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
 go vet -vettool=$(which shadow)
 </pre>
 </p>
 
+<h3 id="tour">Tour</h3>
+
+<p> <!-- CL 152657 -->
+The Go tour is no longer included in the main binary distribution. To
+run the tour locally, instead of running <code>go</code> <code>tool</code> <code>tour</code>,
+manually install it:
+<pre>
+go get -u golang.org/x/tour
+tour
+</pre>
+</p>
+
 <h3 id="gocache">Build cache requirement</h3>
 
 <p>
@@ -139,6 +145,12 @@
 	for more information.
 </p>
 
+<p><!-- CL 152657 -->
+  Mangled C names are no longer accepted in packages that use Cgo. Use the Cgo
+  names instead. For example, use the documented cgo name <code>C.char</code>
+  rather than the mangled name <code>_Ctype_char</code> that cgo generates.
+</p>
+
 <h3 id="modules">Modules</h3>
 
 <p><!-- CL 148517 -->
@@ -163,16 +175,27 @@
 
 <p><!-- CL 147282, 147281 -->
   The <code>go</code> directive in a <code>go.mod</code> file now indicates the
-  version of the language used by the files within that module, and
-  <code>go</code> <code>mod</code> <code>tidy</code> sets it to the
-  current release (<code>go</code> <code>1.12</code>) if no existing
-  version is present.
+  version of the language used by the files within that module.
+  It will be set to the current release
+  (<code>go</code> <code>1.12</code>) if no existing version is
+  present.
   If the <code>go</code> directive for a module specifies a
   version <em>newer</em> than the toolchain in use, the <code>go</code> command
   will attempt to build the packages regardless, and will note the mismatch only if
   that build fails.
 </p>
 
+<p><!-- CL 147282, 147281 -->
+  This changed use of the <code>go</code> directive means that if you
+  use Go 1.12 to build a module, thus recording <code>go 1.12</code>
+  in the <code>go.mod</code> file, you will get an error when
+  attempting to build the same module with Go 1.11 through Go 1.11.3.
+  Go 1.11.4 or later will work fine, as will releases older than Go 1.11.
+  If you must use Go 1.11 through 1.11.3, you can avoid the problem by
+  setting the language version to 1.11, using the Go 1.12 go tool,
+  via <code>go mod edit -go=1.11</code>.
+</p>
+
 <p><!-- CL 152739 -->
   When an import cannot be resolved using the active modules,
   the <code>go</code> command will now try to use the modules mentioned in the
@@ -226,6 +249,23 @@
 </pre>
 </p>
 
+<p><!-- CL 153477 -->
+  Wrappers generated by the compiler to implement method expressions
+  are no longer reported
+  by <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
+  and <a href="/pkg/runtime/#Stack"><code>runtime.Stack</code></a>. They
+  are also not printed in panic stack traces.
+
+  This change aligns the <code>gc</code> toolchain to match
+  the <code>gccgo</code> toolchain, which already elided such wrappers
+  from stack traces.
+
+  Clients of these APIs might need to adjust for the missing
+  frames. For code that must interoperate between 1.11 and 1.12
+  releases, you can replace the method expression <code>x.M</code>
+  with the function literal <code>func (...) { x.M(...) } </code>.
+</p>
+
 <p><!-- CL 144340 -->
   The compiler now accepts a <code>-lang</code> flag to set the Go language
   version to use. For example, <code>-lang=go1.8</code> causes the compiler to
@@ -239,9 +279,9 @@
   except for calls that simultaneously cross between Go and
   assembly <em>and</em> cross a package boundary. If linking results
   in an error like "relocation target not defined for ABIInternal (but
-  is defined for ABI0)", please refer to help section of the ABI
-  design document.
-  <!-- TODO(austin): Link to the design doc. -->
+  is defined for ABI0)", please refer to the
+  <a href="https://github.com/golang/proposal/blob/master/design/27539-internal-abi.md#compatibility">compatibility section</a>
+  of the ABI design document.
 </p>
 
 <p><!-- CL 145179 -->
@@ -267,7 +307,9 @@
 <p>
   In Go 1.12, <code>godoc</code> no longer has a command-line interface and
   is only a web server. Users should use <code>go</code> <code>doc</code>
-  for command-line help output instead.
+  for command-line help output instead. Go 1.12 is the last release that will
+  include the <code>godoc</code> webserver; in Go 1.13 it will be available
+  via <code>go</code> <code>get</code>.
 </p>
 
 <p><!-- CL 141977 -->
@@ -276,6 +318,11 @@
   as the <code>godoc</code> command line used to do.
 </p>
 
+<p><!-- CL 140959 -->
+  <code>go</code> <code>doc</code> also now includes the <code>-src</code> flag,
+  which will show the target's source code.
+</p>
+
 <h3 id="trace">Trace</h3>
 
 <p><!-- CL 60790 -->
@@ -329,20 +376,44 @@
   yet supported on Windows.
 </p>
 
+<p><!-- CL 158337 -->
+  Go 1.12 improves the accuracy of memory profiles by fixing
+  overcounting of large heap allocations.
+</p>
+
+<p><!-- CL 159717 -->
+  Tracebacks, <code>runtime.Caller</code>,
+  and <code>runtime.Callers</code> no longer include
+  compiler-generated initialization functions.  Doing a traceback
+  during the initialization of a global variable will now show a
+  function named <code>PKG.init.ializers</code>.
+</p>
+
 <h2 id="library">Core library</h2>
 
 <h3 id="tls_1_3">TLS 1.3</h3>
 
 <p>
-  Go 1.12 adds support in the <code>crypto/tls</code> package for TLS 1.3 as
-  specified in <a href="https://www.rfc-editor.org/info/rfc8446">RFC 8446</a>.
+  Go 1.12 adds opt-in support for TLS 1.3 in the <code>crypto/tls</code> package as
+  specified by <a href="https://www.rfc-editor.org/info/rfc8446">RFC 8446</a>. It can
+  be enabled by adding the value <code>tls13=1</code> to the <code>GODEBUG</code>
+  environment variable. It will be enabled by default in Go 1.13.
+</p>
 
-  Programs that did not set an explicit <code>MaxVersion</code> in
-  <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> will automatically negotiate
-  TLS 1.3 if available. All TLS 1.2 features except <code>TLSUnique</code> in
+<p>
+  To negotiate TLS 1.3, make sure you do not set an explicit <code>MaxVersion</code> in
+  <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> and run your program with
+  the environment variable <code>GODEBUG=tls13=1</code> set.
+</p>
+
+<p>
+  All TLS 1.2 features except <code>TLSUnique</code> in
   <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
   and renegotiation are available in TLS 1.3 and provide equivalent or
-  better security and performance.
+  better security and performance. Note that even though TLS 1.3 is backwards
+  compatible with previous versions, certain legacy systems might not work
+  correctly when attempting to negotiate it. RSA certificate keys too small
+  to be secure (including 512-bit keys) will not work with TLS 1.3.
 </p>
 
 <p>
@@ -428,19 +499,17 @@
 <dl id="crypto/rc4"><dt><a href="/pkg/crypto/rc4/">crypto/rc4</a></dt>
   <dd>
     <p><!-- CL 130397 -->
-      This release removes the optimized assembly implementations. RC4 is insecure
-      and should only be used for compatibility with legacy systems.
+      This release removes the assembly implementations, leaving only
+      the pure Go version. The Go compiler generates code that is
+      either slightly better or slightly worse, depending on the exact
+      CPU. RC4 is insecure and should only be used for compatibility
+      with legacy systems.
     </p>
 
 </dl><!-- crypto/rc4 -->
 
 <dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
   <dd>
-    <p><!-- CL 146258 -->
-      TLS 1.2 clients and servers will now advertise and accept RSA-PSS
-      signature algorithms for use with regular RSA public keys.
-    </p>
-
     <p><!-- CL 143177 -->
       If a client sends an initial message that does not look like TLS, the server
       will no longer reply with an alert, and it will expose the underlying
@@ -542,16 +611,19 @@
 
 </dl><!-- io -->
 
-<dl id="lib/time"><dt><a href="/pkg/lib/time/">lib/time</a></dt>
+<dl id="math"><dt><a href="/pkg/math/">math</a></dt>
   <dd>
-    <p><!-- CL 151299 -->
-      The time zone database in <code>$GOROOT/lib/time/zoneinfo.zip</code>
-      has been updated to version 2018i. Note that this ZIP file is
-      only used if a time zone database is not provided by the operating
-      system.
+    <p><!-- CL 153059 -->
+      The functions
+      <a href="/pkg/math/#Sin"><code>Sin</code></a>,
+      <a href="/pkg/math/#Cos"><code>Cos</code></a>,
+      <a href="/pkg/math/#Tan"><code>Tan</code></a>,
+      and <a href="/pkg/math/#Sincos"><code>Sincos</code></a> now
+      apply Payne-Hanek range reduction to huge arguments. This
+      produces more accurate answers, but they will not be bit-for-bit
+      identical with the results in earlier releases.
     </p>
-
-</dl><!-- lib/time -->
+</dl><!-- math -->
 
 <dl id="math/bits"><dt><a href="/pkg/math/bits/">math/bits</a></dt>
   <dd>
@@ -615,6 +687,20 @@
 
 </dl><!-- net/http -->
 
+<dl id="net/url"><dt><a href="/pkg/net/url/">net/url</a></dt>
+  <dd>
+    <p><!-- CL 159157, CL 160178 -->
+      <a href="/pkg/net/url/#Parse"><code>Parse</code></a>,
+      <a href="/pkg/net/url/#ParseRequestURI"><code>ParseRequestURI</code></a>,
+      and
+      <a href="/pkg/net/url/#URL.Parse"><code>URL.Parse</code></a>
+      now return an
+      error for URLs containing ASCII control characters, which includes NULL,
+      tab, and newlines.
+    </p>
+
+</dl><!-- net/url -->
+
 <dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
   <dd>
     <p><!-- CL 146437 -->
@@ -705,7 +791,7 @@
       A new <a href="/pkg/runtime/debug/#BuildInfo"><code>BuildInfo</code></a> type
       exposes the build information read from the running binary, available only in
       binaries built with module support. This includes the main package path, main
-      module information, and the module dependencies. This type is given though the
+      module information, and the module dependencies. This type is given through the
       <a href="/pkg/runtime/debug/#ReadBuildInfo"><code>ReadBuildInfo</code></a> function
       on <a href="/pkg/runtime/debug/#BuildInfo"><code>BuildInfo</code></a>.
     </p>
@@ -830,8 +916,25 @@
       <code>executing "tmpl" at <.very.deep.context.value.notpresent>: map has no entry for key "notpresent"</code>
     </p>
 
+  <dd>
+    <p><!-- CL 143097 -->
+      If a user-defined function called by a template panics, the
+      panic is now caught and returned as an error by
+      the <code>Execute</code> or <code>ExecuteTemplate</code> method.
+    </p>
 </dl><!-- text/template -->
 
+<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
+  <dd>
+    <p><!-- CL 151299 -->
+      The time zone database in <code>$GOROOT/lib/time/zoneinfo.zip</code>
+      has been updated to version 2018i. Note that this ZIP file is
+      only used if a time zone database is not provided by the operating
+      system.
+    </p>
+
+</dl><!-- time -->
+
 <dl id="unsafe"><dt><a href="/pkg/unsafe/">unsafe</a></dt>
   <dd>
     <p><!-- CL 146058 -->
diff --git a/doc/go1.3.html b/doc/go1.3.html
index 18c638a..feed648 100644
--- a/doc/go1.3.html
+++ b/doc/go1.3.html
@@ -525,7 +525,7 @@
 The <a href="/pkg/net/http/"><code>net/http</code></a> package's
 <a href="/pkg/net/http/#Request.ParseMultipartForm"><code>Request.ParseMultipartForm</code></a>
 method will now return an error if the body's <code>Content-Type</code>
-is not <code>mutipart/form-data</code>.
+is not <code>multipart/form-data</code>.
 Prior to Go 1.3 it would silently fail and return <code>nil</code>.
 Code that relies on the previous behavior should be updated.
 </li>
diff --git a/doc/install-source.html b/doc/install-source.html
index 2d12a28..bbe7cdf 100644
--- a/doc/install-source.html
+++ b/doc/install-source.html
@@ -349,15 +349,7 @@
 <p>
 The source code for several Go tools (including <a href="/cmd/godoc/">godoc</a>)
 is kept in <a href="https://golang.org/x/tools">the go.tools repository</a>.
-To install all of them, run the <code>go</code> <code>get</code> command:
-</p>
-
-<pre>
-$ go get golang.org/x/tools/cmd/...
-</pre>
-
-<p>
-Or if you just want to install a specific command (<code>godoc</code> in this case):
+To install one of the tools (<code>godoc</code> in this case):
 </p>
 
 <pre>
@@ -374,16 +366,6 @@
 see <a href="/doc/code.html">How to Write Go Code</a> for the details.
 </p>
 
-<p>
-<b>Note</b>: The <code>go</code> command will install the <code>godoc</code>
-binary to <code>$GOROOT/bin</code> (or <code>$GOBIN</code>) and the
-<code>cover</code> and <code>vet</code> binaries to
-<code>$GOROOT/pkg/tool/$GOOS_$GOARCH</code>.
-You can access the latter commands with
-"<code>go</code> <code>tool</code> <code>cover</code>" and
-"<code>go</code> <code>tool</code> <code>vet</code>".
-</p>
-
 <h2 id="community">Community resources</h2>
 
 <p>
@@ -666,7 +648,6 @@
 </p>
 
 <pre>
-export GOROOT=$HOME/go1.X
 export GOARCH=amd64
 export GOOS=linux
 </pre>
diff --git a/doc/install.html b/doc/install.html
index 2e0c7f8..a41c60b 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -172,11 +172,6 @@
 </p>
 
 <p>
-If you chose a directory other than <code>c:\Go</code>,
-you must set the <code>GOROOT</code> environment variable to your chosen path.
-</p>
-
-<p>
 Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\Go\bin</code>) to your <code>PATH</code> environment variable.
 </p>
 
@@ -271,6 +266,39 @@
 </p>
 
 
+<h2 id="extra_versions">Installing extra Go versions</h2>
+
+<p>
+It may be useful to have multiple Go versions installed on the same machine, for
+example, to ensure that a package's tests pass on multiple Go versions.
+Once you have one Go version installed, you can install another (such as 1.10.7)
+as follows:
+</p>
+
+<pre>
+$ go get golang.org/dl/go1.10.7
+$ go1.10.7 download
+</pre>
+
+<p>
+The newly downloaded version can be used like <code>go</code>:
+</p>
+
+<pre>
+$ go1.10.7 version
+go version go1.10.7 linux/amd64
+</pre>
+
+<p>
+All Go versions available via this method are listed on
+<a href="https://godoc.org/golang.org/dl#pkg-subdirectories">the download page</a>.
+You can find where each of these extra Go versions is installed by looking
+at its <code>GOROOT</code>; for example, <code>go1.10.7 env GOROOT</code>.
+To uninstall a downloaded version, just remove its <code>GOROOT</code> directory
+and the <code>goX.Y.Z</code> binary.
+</p>
+
+
 <h2 id="uninstall">Uninstalling Go</h2>
 
 <p>
diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go
index 242ba6c..2cb93d9 100644
--- a/misc/cgo/test/cgo_test.go
+++ b/misc/cgo/test/cgo_test.go
@@ -94,6 +94,7 @@
 func Test26213(t *testing.T)                 { test26213(t) }
 func Test27660(t *testing.T)                 { test27660(t) }
 func Test28896(t *testing.T)                 { test28896(t) }
+func Test30065(t *testing.T)                 { test30065(t) }
 
 func BenchmarkCgoCall(b *testing.B)  { benchCgoCall(b) }
 func BenchmarkGoString(b *testing.B) { benchGoString(b) }
diff --git a/misc/cgo/test/issue29748.go b/misc/cgo/test/issue29748.go
new file mode 100644
index 0000000..8229b3b
--- /dev/null
+++ b/misc/cgo/test/issue29748.go
@@ -0,0 +1,22 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Error handling a struct initializer that requires pointer checking.
+// Compilation test only, nothing to run.
+
+package cgotest
+
+// typedef struct { char **p; } S29748;
+// static int f29748(S29748 *p) { return 0; }
+import "C"
+
+var Vissue29748 = C.f29748(&C.S29748{
+	nil,
+})
+
+func Fissue299748() {
+	C.f29748(&C.S29748{
+		nil,
+	})
+}
diff --git a/misc/cgo/test/issue29781.go b/misc/cgo/test/issue29781.go
new file mode 100644
index 0000000..0fd8c08
--- /dev/null
+++ b/misc/cgo/test/issue29781.go
@@ -0,0 +1,17 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Error with newline inserted into constant expression.
+// Compilation test only, nothing to run.
+
+package cgotest
+
+// static void issue29781F(char **p, int n) {}
+// #define ISSUE29781C 0
+import "C"
+
+func issue29781G() {
+	var p *C.char
+	C.issue29781F(&p, C.ISSUE29781C+1)
+}
diff --git a/misc/cgo/test/issue30065.go b/misc/cgo/test/issue30065.go
new file mode 100644
index 0000000..396d437
--- /dev/null
+++ b/misc/cgo/test/issue30065.go
@@ -0,0 +1,38 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Don't make a private copy of an array when taking the address of an
+// element.
+
+package cgotest
+
+// #include <string.h>
+import "C"
+
+import (
+	"testing"
+	"unsafe"
+)
+
+func test30065(t *testing.T) {
+	var a [256]byte
+	b := []byte("a")
+	C.memcpy(unsafe.Pointer(&a), unsafe.Pointer(&b[0]), 1)
+	if a[0] != 'a' {
+		t.Errorf("&a failed: got %c, want %c", a[0], 'a')
+	}
+
+	b = []byte("b")
+	C.memcpy(unsafe.Pointer(&a[0]), unsafe.Pointer(&b[0]), 1)
+	if a[0] != 'b' {
+		t.Errorf("&a[0] failed: got %c, want %c", a[0], 'b')
+	}
+
+	d := make([]byte, 256)
+	b = []byte("c")
+	C.memcpy(unsafe.Pointer(&d[0]), unsafe.Pointer(&b[0]), 1)
+	if d[0] != 'c' {
+		t.Errorf("&d[0] failed: got %c, want %c", d[0], 'c')
+	}
+}
diff --git a/misc/cgo/test/testdata/issue30527.go b/misc/cgo/test/testdata/issue30527.go
new file mode 100644
index 0000000..4ea7d31
--- /dev/null
+++ b/misc/cgo/test/testdata/issue30527.go
@@ -0,0 +1,14 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 30527: function call rewriting casts untyped
+// constants to int because of ":=" usage.
+
+package cgotest
+
+import "cgotest/issue30527"
+
+func issue30527G() {
+	issue30527.G(nil)
+}
diff --git a/misc/cgo/test/testdata/issue30527/a.go b/misc/cgo/test/testdata/issue30527/a.go
new file mode 100644
index 0000000..eb50147
--- /dev/null
+++ b/misc/cgo/test/testdata/issue30527/a.go
@@ -0,0 +1,19 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package issue30527
+
+import "math"
+
+/*
+#include <inttypes.h>
+
+static void issue30527F(char **p, uint64_t mod, uint32_t unused) {}
+*/
+import "C"
+
+func G(p **C.char) {
+	C.issue30527F(p, math.MaxUint64, 1)
+	C.issue30527F(p, 1<<64-1, Z)
+}
diff --git a/misc/cgo/test/testdata/issue30527/b.go b/misc/cgo/test/testdata/issue30527/b.go
new file mode 100644
index 0000000..87e8255
--- /dev/null
+++ b/misc/cgo/test/testdata/issue30527/b.go
@@ -0,0 +1,11 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package issue30527
+
+const (
+	X = 1 << iota
+	Y
+	Z
+)
diff --git a/misc/sortac/sortac.go b/misc/sortac/sortac.go
deleted file mode 100644
index f61aa96..0000000
--- a/misc/sortac/sortac.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Sortac sorts the AUTHORS and CONTRIBUTORS files.
-//
-// Usage:
-//
-//    sortac [file...]
-//
-// Sortac sorts the named files in place.
-// If given no arguments, it sorts standard input to standard output.
-package main
-
-import (
-	"bufio"
-	"bytes"
-	"flag"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"log"
-	"os"
-
-	"golang.org/x/text/collate"
-	"golang.org/x/text/language"
-)
-
-func main() {
-	log.SetFlags(0)
-	log.SetPrefix("sortac: ")
-	flag.Parse()
-
-	args := flag.Args()
-	if len(args) == 0 {
-		os.Stdout.Write(sortAC(os.Stdin))
-	} else {
-		for _, arg := range args {
-			f, err := os.Open(arg)
-			if err != nil {
-				log.Fatal(err)
-			}
-			sorted := sortAC(f)
-			f.Close()
-			if err := ioutil.WriteFile(arg, sorted, 0644); err != nil {
-				log.Fatal(err)
-			}
-		}
-	}
-}
-
-func sortAC(r io.Reader) []byte {
-	bs := bufio.NewScanner(r)
-	var header []string
-	var lines []string
-	for bs.Scan() {
-		t := bs.Text()
-		lines = append(lines, t)
-		if t == "# Please keep the list sorted." {
-			header = lines
-			lines = nil
-			continue
-		}
-	}
-	if err := bs.Err(); err != nil {
-		log.Fatal(err)
-	}
-
-	var out bytes.Buffer
-	c := collate.New(language.Und, collate.Loose)
-	c.SortStrings(lines)
-	for _, l := range header {
-		fmt.Fprintln(&out, l)
-	}
-	for _, l := range lines {
-		fmt.Fprintln(&out, l)
-	}
-	return out.Bytes()
-}
diff --git a/src/cmd/asm/internal/asm/testdata/arm64.s b/src/cmd/asm/internal/asm/testdata/arm64.s
index d025543..b54fd86 100644
--- a/src/cmd/asm/internal/asm/testdata/arm64.s
+++ b/src/cmd/asm/internal/asm/testdata/arm64.s
@@ -261,6 +261,18 @@
 	ORRW	$0x1b000, R2, R3                    // ORRW	$110592, R2, R3                 // 1b0096523b00a07243001b2a
 	TSTW	$0x500000, R1                       // TSTW	$5242880, R1                    // 1b0aa0523f001b6a
 	TSTW	$0xff00ff, R1                       // TSTW	$16711935, R1                   // 3f9c0072
+	TSTW	$0x60060, R5                        // TSTW	$393312, R5                     // 1b0c8052db00a072bf001b6a
+	TSTW	$0x6006000060060, R5                // TSTW	$1689262177517664, R5           // 1b0c8052db00a072bf001b6a
+	ANDW	$0x6006000060060, R5                // ANDW	$1689262177517664, R5           // 1b0c8052db00a072a5001b0a
+	ANDSW	$0x6006000060060, R5                // ANDSW	$1689262177517664, R5           // 1b0c8052db00a072a5001b6a
+	EORW	$0x6006000060060, R5                // EORW	$1689262177517664, R5           // 1b0c8052db00a072a5001b4a
+	ORRW	$0x6006000060060, R5                // ORRW	$1689262177517664, R5           // 1b0c8052db00a072a5001b2a
+	BICW	$0x6006000060060, R5                // BICW	$1689262177517664, R5           // 1b0c8052db00a072a5003b0a
+	EONW	$0x6006000060060, R5                // EONW	$1689262177517664, R5           // 1b0c8052db00a072a5003b4a
+	ORNW	$0x6006000060060, R5                // ORNW	$1689262177517664, R5           // 1b0c8052db00a072a5003b2a
+	BICSW	$0x6006000060060, R5                // BICSW	$1689262177517664, R5           // 1b0c8052db00a072a5003b6a
+	ADDW	$0x60060, R2                        // ADDW	$393312, R2                     // 4280011142804111
+	CMPW	$0x60060, R2                        // CMPW	$393312, R2                     // 1b0c8052db00a0725f001b6b
 
 	AND	$8, R0, RSP // 1f007d92
 	ORR	$8, R0, RSP // 1f007db2
diff --git a/src/cmd/cgo/ast.go b/src/cmd/cgo/ast.go
index 83d727a..54d6bc2 100644
--- a/src/cmd/cgo/ast.go
+++ b/src/cmd/cgo/ast.go
@@ -200,18 +200,6 @@
 		}
 	case *ast.CallExpr:
 		f.saveCall(x, context)
-	case *ast.GenDecl:
-		if x.Tok == token.CONST {
-			for _, spec := range x.Specs {
-				vs := spec.(*ast.ValueSpec)
-				if vs.Type == nil {
-					for _, name := range spec.(*ast.ValueSpec).Names {
-						consts[name.Name] = true
-					}
-				}
-			}
-		}
-
 	}
 }
 
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index 65f9f6e..915ad66 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -897,21 +897,16 @@
 			needsUnsafe = true
 		}
 
-		// Explicitly convert untyped constants to the
-		// parameter type, to avoid a type mismatch.
-		if p.isConst(f, arg) {
-			ptype := p.rewriteUnsafe(param.Go)
+		// Use "var x T = ..." syntax to explicitly convert untyped
+		// constants to the parameter type, to avoid a type mismatch.
+		ptype := p.rewriteUnsafe(param.Go)
+
+		if !p.needsPointerCheck(f, param.Go, args[i]) || param.BadPointer {
 			if ptype != param.Go {
 				needsUnsafe = true
 			}
-			arg = &ast.CallExpr{
-				Fun:  ptype,
-				Args: []ast.Expr{arg},
-			}
-		}
-
-		if !p.needsPointerCheck(f, param.Go, args[i]) {
-			fmt.Fprintf(&sb, "_cgo%d := %s; ", i, gofmtPos(arg, origArg.Pos()))
+			fmt.Fprintf(&sb, "var _cgo%d %s = %s; ", i,
+				gofmtLine(ptype), gofmtPos(arg, origArg.Pos()))
 			continue
 		}
 
@@ -1121,14 +1116,19 @@
 }
 
 // checkIndex checks whether arg has the form &a[i], possibly inside
-// type conversions. If so, it writes
+// type conversions. If so, then in the general case it writes
 //    _cgoIndexNN := a
 //    _cgoNN := &cgoIndexNN[i] // with type conversions, if any
 // to sb, and writes
 //    _cgoCheckPointer(_cgoNN, _cgoIndexNN)
-// to sbCheck, and returns true. This tells _cgoCheckPointer to check
-// the complete contents of the slice or array being indexed, but no
-// other part of the memory allocation.
+// to sbCheck, and returns true. If a is a simple variable or field reference,
+// it writes
+//    _cgoIndexNN := &a
+// and dereferences the uses of _cgoIndexNN. Taking the address avoids
+// making a copy of an array.
+//
+// This tells _cgoCheckPointer to check the complete contents of the
+// slice or array being indexed, but no other part of the memory allocation.
 func (p *Package) checkIndex(sb, sbCheck *bytes.Buffer, arg ast.Expr, i int) bool {
 	// Strip type conversions.
 	x := arg
@@ -1148,13 +1148,23 @@
 		return false
 	}
 
-	fmt.Fprintf(sb, "_cgoIndex%d := %s; ", i, gofmtPos(index.X, index.X.Pos()))
+	addr := ""
+	deref := ""
+	if p.isVariable(index.X) {
+		addr = "&"
+		deref = "*"
+	}
+
+	fmt.Fprintf(sb, "_cgoIndex%d := %s%s; ", i, addr, gofmtPos(index.X, index.X.Pos()))
 	origX := index.X
 	index.X = ast.NewIdent(fmt.Sprintf("_cgoIndex%d", i))
+	if deref == "*" {
+		index.X = &ast.StarExpr{X: index.X}
+	}
 	fmt.Fprintf(sb, "_cgo%d := %s; ", i, gofmtPos(arg, arg.Pos()))
 	index.X = origX
 
-	fmt.Fprintf(sbCheck, "_cgoCheckPointer(_cgo%d, _cgoIndex%d); ", i, i)
+	fmt.Fprintf(sbCheck, "_cgoCheckPointer(_cgo%d, %s_cgoIndex%d); ", i, deref, i)
 
 	return true
 }
@@ -1239,43 +1249,13 @@
 	return false
 }
 
-// isConst reports whether x is an untyped constant expression.
-func (p *Package) isConst(f *File, x ast.Expr) bool {
+// isVariable reports whether x is a variable, possibly with field references.
+func (p *Package) isVariable(x ast.Expr) bool {
 	switch x := x.(type) {
-	case *ast.BasicLit:
+	case *ast.Ident:
 		return true
 	case *ast.SelectorExpr:
-		id, ok := x.X.(*ast.Ident)
-		if !ok || id.Name != "C" {
-			return false
-		}
-		name := f.Name[x.Sel.Name]
-		if name != nil {
-			return name.IsConst()
-		}
-	case *ast.Ident:
-		return x.Name == "nil" ||
-			strings.HasPrefix(x.Name, "_Ciconst_") ||
-			strings.HasPrefix(x.Name, "_Cfconst_") ||
-			strings.HasPrefix(x.Name, "_Csconst_") ||
-			consts[x.Name]
-	case *ast.UnaryExpr:
-		return p.isConst(f, x.X)
-	case *ast.BinaryExpr:
-		return p.isConst(f, x.X) && p.isConst(f, x.Y)
-	case *ast.ParenExpr:
-		return p.isConst(f, x.X)
-	case *ast.CallExpr:
-		// Calling the builtin function complex on two untyped
-		// constants returns an untyped constant.
-		// TODO: It's possible to construct a case that will
-		// erroneously succeed if there is a local function
-		// named "complex", shadowing the builtin, that returns
-		// a numeric type. I can't think of any cases that will
-		// erroneously fail.
-		if id, ok := x.Fun.(*ast.Ident); ok && id.Name == "complex" && len(x.Args) == 2 {
-			return p.isConst(f, x.Args[0]) && p.isConst(f, x.Args[1])
-		}
+		return p.isVariable(x.X)
 	}
 	return false
 }
@@ -2485,13 +2465,16 @@
 			// Treat this typedef as a uintptr.
 			s := *sub
 			s.Go = c.uintptr
+			s.BadPointer = true
 			sub = &s
 			// Make sure we update any previously computed type.
 			if oldType := typedef[name.Name]; oldType != nil {
 				oldType.Go = sub.Go
+				oldType.BadPointer = true
 			}
 		}
 		t.Go = name
+		t.BadPointer = sub.BadPointer
 		if unionWithPointer[sub.Go] {
 			unionWithPointer[t.Go] = true
 		}
@@ -2501,6 +2484,7 @@
 		if oldType == nil {
 			tt := *t
 			tt.Go = sub.Go
+			tt.BadPointer = sub.BadPointer
 			typedef[name.Name] = &tt
 		}
 
diff --git a/src/cmd/cgo/godefs.go b/src/cmd/cgo/godefs.go
index 9c763a2..64384a6 100644
--- a/src/cmd/cgo/godefs.go
+++ b/src/cmd/cgo/godefs.go
@@ -127,8 +127,35 @@
 	return gofmtBuf.String()
 }
 
+// gofmtLineReplacer is used to put a gofmt-formatted string for an
+// AST expression onto a single line. The lexer normally inserts a
+// semicolon at each newline, so we can replace newline with semicolon.
+// However, we can't do that in cases where the lexer would not insert
+// a semicolon. We only have to worry about cases that can occur in an
+// expression passed through gofmt, which means composite literals and
+// (due to the printer possibly inserting newlines because of position
+// information) operators.
+var gofmtLineReplacer = strings.NewReplacer(
+	"{\n", "{",
+	",\n", ",",
+	"++\n", "++;",
+	"--\n", "--;",
+	"+\n", "+",
+	"-\n", "-",
+	"*\n", "*",
+	"/\n", "/",
+	"%\n", "%",
+	"&\n", "&",
+	"|\n", "|",
+	"^\n", "^",
+	"<\n", "<",
+	">\n", ">",
+	"=\n", "=",
+	"\n", ";",
+)
+
 // gofmtLine returns the gofmt-formatted string for an AST node,
 // ensuring that it is on a single line.
 func gofmtLine(n interface{}) string {
-	return strings.Replace(gofmt(n), "\n", ";", -1)
+	return gofmtLineReplacer.Replace(gofmt(n))
 }
diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go
index 80435b0..5a7bb3f 100644
--- a/src/cmd/cgo/main.go
+++ b/src/cmd/cgo/main.go
@@ -71,9 +71,6 @@
 	Edit     *edit.Buffer
 }
 
-// Untyped constants in the current package.
-var consts = make(map[string]bool)
-
 func (f *File) offset(p token.Pos) int {
 	return fset.Position(p).Offset
 }
@@ -154,6 +151,7 @@
 	Go         ast.Expr
 	EnumValues map[string]int64
 	Typedef    string
+	BadPointer bool
 }
 
 // A FuncType collects information about a function type in both the C and Go worlds.
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
index 0985a7e..0cf8b17 100644
--- a/src/cmd/cgo/out.go
+++ b/src/cmd/cgo/out.go
@@ -776,6 +776,13 @@
 	fmt.Fprintf(fgcc, "#include <stdlib.h>\n")
 	fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n")
 
+	// We use packed structs, but they are always aligned.
+	// The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first.
+	// remove as part of #27619 (all: drop support for FreeBSD 10).
+	fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n")
+	fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wpragmas\"\n")
+	fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Waddress-of-packed-member\"\n")
+
 	fmt.Fprintf(fgcc, "extern void crosscall2(void (*fn)(void *, int, __SIZE_TYPE__), void *, int, __SIZE_TYPE__);\n")
 	fmt.Fprintf(fgcc, "extern __SIZE_TYPE__ _cgo_wait_runtime_init_done();\n")
 	fmt.Fprintf(fgcc, "extern void _cgo_release_context(__SIZE_TYPE__);\n\n")
@@ -1255,7 +1262,7 @@
 	cmd := exec.Command(gccgocmd, "-S", "-o", "-", gofilename)
 	buf, cerr := cmd.CombinedOutput()
 	if cerr != nil {
-		fatalf("%s", err)
+		fatalf("%s", cerr)
 	}
 
 	// New mangling: expect go.l..u00e4ufer.Run
@@ -1473,6 +1480,14 @@
 
 extern char* _cgo_topofstack(void);
 
+/* We use packed structs, but they are always aligned.  */
+/* The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first. */
+/* remove as part of #27619 (all: drop support for FreeBSD 10). */
+
+#pragma GCC diagnostic ignored "-Wunknown-pragmas"
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+
 #include <errno.h>
 #include <string.h>
 `
diff --git a/src/cmd/compile/doc.go b/src/cmd/compile/doc.go
index e2a19d9..5291a8b 100644
--- a/src/cmd/compile/doc.go
+++ b/src/cmd/compile/doc.go
@@ -44,8 +44,12 @@
 		Print compiler version and exit.
 	-asmhdr file
 		Write assembly header to file.
+	-buildid id
+		Record id as the build id in the export metadata.
 	-blockprofile file
 		Write block profile for the compilation to file.
+	-c int
+		Concurrency during compilation. Set 1 for no concurrency (default is 1).
 	-complete
 		Assume package has no non-Go components.
 	-cpuprofile file
@@ -54,8 +58,14 @@
 		Allow references to Go symbols in shared libraries (experimental).
 	-e
 		Remove the limit on the number of errors reported (default limit is 10).
+	-goversion string
+		Specify required go tool version of the runtime.
+		Exits when the runtime go version does not match goversion.
 	-h
 		Halt with a stack trace at the first error detected.
+	-importcfg file
+		Read import configuration from file.
+		In the file, set importmap, packagefile to specify import resolution.
 	-importmap old=new
 		Interpret import "old" as import "new" during compilation.
 		The option may be repeated to add multiple mappings.
@@ -74,6 +84,8 @@
 		object to usual output file (as specified by -o).
 		Without this flag, the -o output is a combination of both
 		linker and compiler input.
+	-m
+		Print optimization decisions.
 	-memprofile file
 		Write memory profile for the compilation to file.
 	-memprofilerate rate
@@ -93,11 +105,50 @@
 		Write a package (archive) file rather than an object file
 	-race
 		Compile with race detector enabled.
+	-s
+		Warn about composite literals that can be simplified.
+	-shared
+		Generate code that can be linked into a shared library.
+	-traceprofile file
+		Write an execution trace to file.
 	-trimpath prefix
 		Remove prefix from recorded source file paths.
 
-There are also a number of debugging flags; run the command with no arguments
-for a usage message.
+Flags related to debugging information:
+
+	-dwarf
+		Generate DWARF symbols.
+	-dwarflocationlists
+		Add location lists to DWARF in optimized mode.
+	-gendwarfinl int
+		Generate DWARF inline info records (default 2).
+
+Flags to debug the compiler itself:
+
+	-E
+		Debug symbol export.
+	-K
+		Debug missing line numbers.
+	-d list
+		Print debug information about items in list. Try -d help for further information.
+	-live
+		Debug liveness analysis.
+	-v
+		Increase debug verbosity.
+	-%
+		Debug non-static initializers.
+	-W
+		Debug parse tree after type checking.
+	-f
+		Debug stack frames.
+	-i
+		Debug line number stack.
+	-j
+		Debug runtime-initialized variables.
+	-r
+		Debug generated wrappers.
+	-w
+		Debug type checking.
 
 Compiler Directives
 
diff --git a/src/cmd/compile/internal/amd64/galign.go b/src/cmd/compile/internal/amd64/galign.go
index 58c46999..f6bb961 100644
--- a/src/cmd/compile/internal/amd64/galign.go
+++ b/src/cmd/compile/internal/amd64/galign.go
@@ -24,6 +24,7 @@
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 
 	arch.SSAMarkMoves = ssaMarkMoves
 	arch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/arm/galign.go b/src/cmd/compile/internal/arm/galign.go
index 241edaf..8469dbd 100644
--- a/src/cmd/compile/internal/arm/galign.go
+++ b/src/cmd/compile/internal/arm/galign.go
@@ -19,6 +19,7 @@
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 
 	arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
 	arch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/arm64/galign.go b/src/cmd/compile/internal/arm64/galign.go
index a64be8e..f01fe8a 100644
--- a/src/cmd/compile/internal/arm64/galign.go
+++ b/src/cmd/compile/internal/arm64/galign.go
@@ -19,6 +19,7 @@
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 
 	arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
 	arch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/gc/dwinl.go b/src/cmd/compile/internal/gc/dwinl.go
index ade76f4..cc42a04 100644
--- a/src/cmd/compile/internal/gc/dwinl.go
+++ b/src/cmd/compile/internal/gc/dwinl.go
@@ -127,7 +127,7 @@
 				DeclLine: v.DeclLine,
 				DeclCol:  v.DeclCol,
 			}
-			synthesized := strings.HasPrefix(v.Name, "~r") || canonName == "_"
+			synthesized := strings.HasPrefix(v.Name, "~r") || canonName == "_" || strings.HasPrefix(v.Name, "~b")
 			if idx, found := m[vp]; found {
 				v.ChildIndex = int32(idx)
 				v.IsInAbstract = !synthesized
diff --git a/src/cmd/compile/internal/gc/esc.go b/src/cmd/compile/internal/gc/esc.go
index 322b2dc..bd0fb82 100644
--- a/src/cmd/compile/internal/gc/esc.go
+++ b/src/cmd/compile/internal/gc/esc.go
@@ -2105,6 +2105,16 @@
 				step.describe(src)
 			}
 			extraloopdepth = modSrcLoopdepth
+			if src.Op == OCONVIFACE {
+				lt := src.Left.Type
+				if !lt.IsInterface() && !isdirectiface(lt) && types.Haspointers(lt) {
+					// We're converting from a non-direct interface type.
+					// The interface will hold a heap copy of the data
+					// (by calling convT2I or friend). Flow the data to heap.
+					// See issue 29353.
+					e.escwalk(level, &e.theSink, src.Left, e.stepWalk(dst, src.Left, "interface-converted", step))
+				}
+			}
 		}
 
 	case ODOT,
diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go
index 376637b..40d01e2 100644
--- a/src/cmd/compile/internal/gc/go.go
+++ b/src/cmd/compile/internal/gc/go.go
@@ -255,9 +255,10 @@
 	Use387    bool // should 386 backend use 387 FP instructions instead of sse2.
 	SoftFloat bool
 
-	PadFrame  func(int64) int64
-	ZeroRange func(*Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog
-	Ginsnop   func(*Progs) *obj.Prog
+	PadFrame     func(int64) int64
+	ZeroRange    func(*Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog
+	Ginsnop      func(*Progs) *obj.Prog
+	Ginsnopdefer func(*Progs) *obj.Prog // special ginsnop for deferreturn
 
 	// SSAMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
 	SSAMarkMoves func(*SSAGenState, *ssa.Block)
diff --git a/src/cmd/compile/internal/gc/init.go b/src/cmd/compile/internal/gc/init.go
index ae87488..e981f83 100644
--- a/src/cmd/compile/internal/gc/init.go
+++ b/src/cmd/compile/internal/gc/init.go
@@ -57,6 +57,9 @@
 
 // fninit hand-crafts package initialization code.
 //
+//      func init.ializers() {                          (0)
+//              <init stmts>
+//      }
 //      var initdone· uint8                             (1)
 //      func init() {                                   (2)
 //              if initdone· > 1 {                      (3)
@@ -68,7 +71,7 @@
 //              initdone· = 1                           (5)
 //              // over all matching imported symbols
 //                      <pkg>.init()                    (6)
-//              { <init stmts> }                        (7)
+//              init.ializers()                         (7)
 //              init.<n>() // if any                    (8)
 //              initdone· = 2                           (9)
 //              return                                  (10)
@@ -80,6 +83,27 @@
 		return
 	}
 
+	// (0)
+	// Make a function that contains all the initialization statements.
+	// This is a separate function because we want it to appear in
+	// stack traces, where the init function itself does not.
+	var initializers *types.Sym
+	if len(nf) > 0 {
+		lineno = nf[0].Pos // prolog/epilog gets line number of first init stmt
+		initializers = lookup("init.ializers")
+		disableExport(initializers)
+		fn := dclfunc(initializers, nod(OTFUNC, nil, nil))
+		fn.Nbody.Set(nf)
+		funcbody()
+
+		fn = typecheck(fn, ctxStmt)
+		Curfn = fn
+		typecheckslice(nf, ctxStmt)
+		Curfn = nil
+		funccompile(fn)
+		lineno = autogeneratedPos
+	}
+
 	var r []*Node
 
 	// (1)
@@ -130,7 +154,11 @@
 	}
 
 	// (7)
-	r = append(r, nf...)
+	if initializers != nil {
+		n := newname(initializers)
+		addvar(n, functype(nil, nil, nil), PFUNC)
+		r = append(r, nod(OCALL, n, nil))
+	}
 
 	// (8)
 
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index f44d19b..98ff2a3 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -563,11 +563,6 @@
 		errorexit()
 	}
 
-	// The "init" function is the only user-spellable symbol that
-	// we construct later. Mark it as a function now before
-	// anything can ask for its Linksym.
-	lookup("init").SetFunc(true)
-
 	// Phase 4: Decide how to capture closed variables.
 	// This needs to run before escape analysis,
 	// because variables captured by value do not escape.
diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go
index 5630e12..86d52f5 100644
--- a/src/cmd/compile/internal/gc/obj.go
+++ b/src/cmd/compile/internal/gc/obj.go
@@ -287,7 +287,7 @@
 			}
 		}
 		if x := s.Func.StackObjects; x != nil {
-			ggloblsym(x, int32(len(x.P)), obj.RODATA|obj.LOCAL)
+			ggloblsym(x, int32(len(x.P)), obj.RODATA|obj.DUPOK)
 		}
 	}
 }
diff --git a/src/cmd/compile/internal/gc/order.go b/src/cmd/compile/internal/gc/order.go
index 4848a02..c252e7a 100644
--- a/src/cmd/compile/internal/gc/order.go
+++ b/src/cmd/compile/internal/gc/order.go
@@ -1108,10 +1108,10 @@
 		if n.Left.Type.IsInterface() {
 			break
 		}
-		if _, needsaddr := convFuncName(n.Left.Type, n.Type); needsaddr || consttype(n.Left) > 0 {
+		if _, needsaddr := convFuncName(n.Left.Type, n.Type); needsaddr || isStaticCompositeLiteral(n.Left) {
 			// Need a temp if we need to pass the address to the conversion function.
-			// We also process constants here, making a named static global whose
-			// address we can put directly in an interface (see OCONVIFACE case in walk).
+			// We also process static composite literal node here, making a named static global
+			// whose address we can put directly in an interface (see OCONVIFACE case in walk).
 			n.Left = o.addrTemp(n.Left)
 		}
 
@@ -1130,14 +1130,40 @@
 		}
 
 	case OANDAND, OOROR:
-		mark := o.markTemp()
-		n.Left = o.expr(n.Left, nil)
+		// ... = LHS && RHS
+		//
+		// var r bool
+		// r = LHS
+		// if r {       // or !r, for OROR
+		//     r = RHS
+		// }
+		// ... = r
 
-		// Clean temporaries from first branch at beginning of second.
-		// Leave them on the stack so that they can be killed in the outer
-		// context in case the short circuit is taken.
-		n.Right = addinit(n.Right, o.cleanTempNoPop(mark))
-		n.Right = o.exprInPlace(n.Right)
+		r := o.newTemp(n.Type, false)
+
+		// Evaluate left-hand side.
+		lhs := o.expr(n.Left, nil)
+		o.out = append(o.out, typecheck(nod(OAS, r, lhs), ctxStmt))
+
+		// Evaluate right-hand side, save generated code.
+		saveout := o.out
+		o.out = nil
+		t := o.markTemp()
+		rhs := o.expr(n.Right, nil)
+		o.out = append(o.out, typecheck(nod(OAS, r, rhs), ctxStmt))
+		o.cleanTemp(t)
+		gen := o.out
+		o.out = saveout
+
+		// If left-hand side doesn't cause a short-circuit, issue right-hand side.
+		nif := nod(OIF, r, nil)
+		if n.Op == OANDAND {
+			nif.Nbody.Set(gen)
+		} else {
+			nif.Rlist.Set(gen)
+		}
+		o.out = append(o.out, nif)
+		n = r
 
 	case OCALLFUNC,
 		OCALLINTER,
diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go
index 63e5860..5636ccd 100644
--- a/src/cmd/compile/internal/gc/pgen.go
+++ b/src/cmd/compile/internal/gc/pgen.go
@@ -243,6 +243,14 @@
 	// From this point, there should be no uses of Curfn. Enforce that.
 	Curfn = nil
 
+	if fn.funcname() == "_" {
+		// We don't need to generate code for this function, just report errors in its body.
+		// At this point we've generated any errors needed.
+		// (Beyond here we generate only non-spec errors, like "stack frame too large".)
+		// See issue 29870.
+		return
+	}
+
 	// Set up the function's LSym early to avoid data races with the assemblers.
 	fn.Func.initLSym(true)
 
@@ -259,7 +267,7 @@
 					// Also make sure we allocate a linker symbol
 					// for the stack object data, for the same reason.
 					if fn.Func.lsym.Func.StackObjects == nil {
-						fn.Func.lsym.Func.StackObjects = lookup(fmt.Sprintf("%s.stkobj", fn.funcname())).Linksym()
+						fn.Func.lsym.Func.StackObjects = Ctxt.Lookup(fn.Func.lsym.Name + ".stkobj")
 					}
 				}
 			}
@@ -589,8 +597,22 @@
 		typename := dwarf.InfoPrefix + typesymname(n.Type)
 		decls = append(decls, n)
 		abbrev := dwarf.DW_ABRV_AUTO_LOCLIST
+		isReturnValue := (n.Class() == PPARAMOUT)
 		if n.Class() == PPARAM || n.Class() == PPARAMOUT {
 			abbrev = dwarf.DW_ABRV_PARAM_LOCLIST
+		} else if n.Class() == PAUTOHEAP {
+			// If dcl in question has been promoted to heap, do a bit
+			// of extra work to recover original class (auto or param);
+			// see issue 30908. This insures that we get the proper
+			// signature in the abstract function DIE, but leaves a
+			// misleading location for the param (we want pointer-to-heap
+			// and not stack).
+			// TODO(thanm): generate a better location expression
+			stackcopy := n.Name.Param.Stackcopy
+			if stackcopy != nil && (stackcopy.Class() == PPARAM || stackcopy.Class() == PPARAMOUT) {
+				abbrev = dwarf.DW_ABRV_PARAM_LOCLIST
+				isReturnValue = (stackcopy.Class() == PPARAMOUT)
+			}
 		}
 		inlIndex := 0
 		if genDwarfInline > 1 {
@@ -604,7 +626,7 @@
 		declpos := Ctxt.InnermostPos(n.Pos)
 		vars = append(vars, &dwarf.Var{
 			Name:          n.Sym.Name,
-			IsReturnValue: n.Class() == PPARAMOUT,
+			IsReturnValue: isReturnValue,
 			Abbrev:        abbrev,
 			StackOffset:   int32(n.Xoffset),
 			Type:          Ctxt.Lookup(typename),
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index db26f13..6ae97ad 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -106,7 +106,7 @@
 	WasmDiv = sysvar("wasmDiv")
 	WasmTruncS = sysvar("wasmTruncS")
 	WasmTruncU = sysvar("wasmTruncU")
-	SigPanic = sysvar("sigpanic")
+	SigPanic = sysfunc("sigpanic")
 }
 
 // buildssa builds an SSA function for fn.
@@ -993,26 +993,32 @@
 		s.assign(n.Left, r, deref, skip)
 
 	case OIF:
-		bThen := s.f.NewBlock(ssa.BlockPlain)
 		bEnd := s.f.NewBlock(ssa.BlockPlain)
-		var bElse *ssa.Block
 		var likely int8
 		if n.Likely() {
 			likely = 1
 		}
+		var bThen *ssa.Block
+		if n.Nbody.Len() != 0 {
+			bThen = s.f.NewBlock(ssa.BlockPlain)
+		} else {
+			bThen = bEnd
+		}
+		var bElse *ssa.Block
 		if n.Rlist.Len() != 0 {
 			bElse = s.f.NewBlock(ssa.BlockPlain)
-			s.condBranch(n.Left, bThen, bElse, likely)
 		} else {
-			s.condBranch(n.Left, bThen, bEnd, likely)
+			bElse = bEnd
 		}
+		s.condBranch(n.Left, bThen, bElse, likely)
 
-		s.startBlock(bThen)
-		s.stmtList(n.Nbody)
-		if b := s.endBlock(); b != nil {
-			b.AddEdgeTo(bEnd)
+		if n.Nbody.Len() != 0 {
+			s.startBlock(bThen)
+			s.stmtList(n.Nbody)
+			if b := s.endBlock(); b != nil {
+				b.AddEdgeTo(bEnd)
+			}
 		}
-
 		if n.Rlist.Len() != 0 {
 			s.startBlock(bElse)
 			s.stmtList(n.Rlist)
@@ -5597,7 +5603,7 @@
 		// insert an actual hardware NOP that will have the right line number.
 		// This is different from obj.ANOP, which is a virtual no-op
 		// that doesn't make it into the instruction stream.
-		thearch.Ginsnop(s.pp)
+		thearch.Ginsnopdefer(s.pp)
 	}
 
 	if sym, ok := v.Aux.(*obj.LSym); ok {
diff --git a/src/cmd/compile/internal/mips/galign.go b/src/cmd/compile/internal/mips/galign.go
index f207a17..596dbd7 100644
--- a/src/cmd/compile/internal/mips/galign.go
+++ b/src/cmd/compile/internal/mips/galign.go
@@ -22,6 +22,7 @@
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 	arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
 	arch.SSAGenValue = ssaGenValue
 	arch.SSAGenBlock = ssaGenBlock
diff --git a/src/cmd/compile/internal/mips64/galign.go b/src/cmd/compile/internal/mips64/galign.go
index 5252719..07e9f98 100644
--- a/src/cmd/compile/internal/mips64/galign.go
+++ b/src/cmd/compile/internal/mips64/galign.go
@@ -22,6 +22,7 @@
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 
 	arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
 	arch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/ppc64/galign.go b/src/cmd/compile/internal/ppc64/galign.go
index da971d8..8ad3084 100644
--- a/src/cmd/compile/internal/ppc64/galign.go
+++ b/src/cmd/compile/internal/ppc64/galign.go
@@ -20,7 +20,8 @@
 
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
-	arch.Ginsnop = ginsnop2
+	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop2
 
 	arch.SSAMarkMoves = ssaMarkMoves
 	arch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/s390x/galign.go b/src/cmd/compile/internal/s390x/galign.go
index 3f62469..26359ab 100644
--- a/src/cmd/compile/internal/s390x/galign.go
+++ b/src/cmd/compile/internal/s390x/galign.go
@@ -17,6 +17,7 @@
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 
 	arch.SSAMarkMoves = ssaMarkMoves
 	arch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/ssa/gen/PPC64.rules b/src/cmd/compile/internal/ssa/gen/PPC64.rules
index 24cee6f..e5d5295 100644
--- a/src/cmd/compile/internal/ssa/gen/PPC64.rules
+++ b/src/cmd/compile/internal/ssa/gen/PPC64.rules
@@ -930,11 +930,11 @@
 (ZeroExt16to(32|64) x) -> (MOVHZreg x)
 (ZeroExt32to64 x) -> (MOVWZreg x)
 
-(Trunc(16|32|64)to8  x) && isSigned(x.Type) -> (MOVBreg x)
+(Trunc(16|32|64)to8 <t> x) && isSigned(t) -> (MOVBreg x)
 (Trunc(16|32|64)to8  x) -> (MOVBZreg x)
-(Trunc(32|64)to16 x) && isSigned(x.Type) -> (MOVHreg x)
+(Trunc(32|64)to16 <t> x) && isSigned(t) -> (MOVHreg x)
 (Trunc(32|64)to16 x) -> (MOVHZreg x)
-(Trunc64to32 x) && isSigned(x.Type) -> (MOVWreg x)
+(Trunc64to32 <t> x) && isSigned(t) -> (MOVWreg x)
 (Trunc64to32 x) -> (MOVWZreg x)
 
 (Slicemask <t> x) -> (SRADconst (NEG <t> x) [63])
diff --git a/src/cmd/compile/internal/ssa/gen/generic.rules b/src/cmd/compile/internal/ssa/gen/generic.rules
index 89fbfdc..6145189 100644
--- a/src/cmd/compile/internal/ssa/gen/generic.rules
+++ b/src/cmd/compile/internal/ssa/gen/generic.rules
@@ -1354,6 +1354,7 @@
 // Inline small or disjoint runtime.memmove calls with constant length.
 (StaticCall {sym} s1:(Store _ (Const(64|32) [sz]) s2:(Store  _ src s3:(Store {t} _ dst mem))))
 	&& isSameSym(sym,"runtime.memmove")
+	&& t.(*types.Type).IsPtr() // avoids TUINTPTR, see issue 30061
 	&& s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1
 	&& isInlinableMemmove(dst,src,sz,config)
 	&& clobber(s1) && clobber(s2) && clobber(s3)
diff --git a/src/cmd/compile/internal/ssa/gen/rulegen.go b/src/cmd/compile/internal/ssa/gen/rulegen.go
index 34517b4..730e768 100644
--- a/src/cmd/compile/internal/ssa/gen/rulegen.go
+++ b/src/cmd/compile/internal/ssa/gen/rulegen.go
@@ -209,7 +209,11 @@
 
 				canFail = false
 				fmt.Fprintf(buf, "for {\n")
-				if genMatch(buf, arch, match, rule.loc) {
+				pos, matchCanFail := genMatch(buf, arch, match, rule.loc)
+				if pos == "" {
+					pos = "v.Pos"
+				}
+				if matchCanFail {
 					canFail = true
 				}
 
@@ -221,7 +225,7 @@
 					log.Fatalf("unconditional rule %s is followed by other rules", match)
 				}
 
-				genResult(buf, arch, result, rule.loc)
+				genResult(buf, arch, result, rule.loc, pos)
 				if *genLog {
 					fmt.Fprintf(buf, "logRule(\"%s\")\n", rule.loc)
 				}
@@ -291,10 +295,11 @@
 			_, _, _, aux, s := extract(match) // remove parens, then split
 
 			// check match of control value
+			pos := ""
 			if s[0] != "nil" {
 				fmt.Fprintf(w, "v := b.Control\n")
 				if strings.Contains(s[0], "(") {
-					genMatch0(w, arch, s[0], "v", map[string]struct{}{}, false, rule.loc)
+					pos, _ = genMatch0(w, arch, s[0], "v", map[string]struct{}{}, false, rule.loc)
 				} else {
 					fmt.Fprintf(w, "_ = v\n") // in case we don't use v
 					fmt.Fprintf(w, "%s := b.Control\n", s[0])
@@ -335,7 +340,10 @@
 			if t[0] == "nil" {
 				fmt.Fprintf(w, "b.SetControl(nil)\n")
 			} else {
-				fmt.Fprintf(w, "b.SetControl(%s)\n", genResult0(w, arch, t[0], new(int), false, false, rule.loc))
+				if pos == "" {
+					pos = "v.Pos"
+				}
+				fmt.Fprintf(w, "b.SetControl(%s)\n", genResult0(w, arch, t[0], new(int), false, false, rule.loc, pos))
 			}
 			if aux != "" {
 				fmt.Fprintf(w, "b.Aux = %s\n", aux)
@@ -386,15 +394,17 @@
 	}
 }
 
-// genMatch reports whether the match can fail.
-func genMatch(w io.Writer, arch arch, match string, loc string) bool {
+// genMatch returns the variable whose source position should be used for the
+// result (or "" if no opinion), and a boolean that reports whether the match can fail.
+func genMatch(w io.Writer, arch arch, match string, loc string) (string, bool) {
 	return genMatch0(w, arch, match, "v", map[string]struct{}{}, true, loc)
 }
 
-func genMatch0(w io.Writer, arch arch, match, v string, m map[string]struct{}, top bool, loc string) bool {
+func genMatch0(w io.Writer, arch arch, match, v string, m map[string]struct{}, top bool, loc string) (string, bool) {
 	if match[0] != '(' || match[len(match)-1] != ')' {
 		panic("non-compound expr in genMatch0: " + match)
 	}
+	pos := ""
 	canFail := false
 
 	op, oparch, typ, auxint, aux, args := parseValue(match, arch, loc)
@@ -404,6 +414,10 @@
 		fmt.Fprintf(w, "if %s.Op != Op%s%s {\nbreak\n}\n", v, oparch, op.name)
 		canFail = true
 	}
+	if op.faultOnNilArg0 || op.faultOnNilArg1 {
+		// Prefer the position of an instruction which could fault.
+		pos = v + ".Pos"
+	}
 
 	if typ != "" {
 		if !isVariable(typ) {
@@ -494,7 +508,16 @@
 			argname = fmt.Sprintf("%s_%d", v, i)
 		}
 		fmt.Fprintf(w, "%s := %s.Args[%d]\n", argname, v, i)
-		if genMatch0(w, arch, arg, argname, m, false, loc) {
+		argPos, argCanFail := genMatch0(w, arch, arg, argname, m, false, loc)
+		if argPos != "" {
+			// Keep the argument in preference to the parent, as the
+			// argument is normally earlier in program flow.
+			// Keep the argument in preference to an earlier argument,
+			// as that prefers the memory argument which is also earlier
+			// in the program flow.
+			pos = argPos
+		}
+		if argCanFail {
 			canFail = true
 		}
 	}
@@ -503,10 +526,10 @@
 		fmt.Fprintf(w, "if len(%s.Args) != %d {\nbreak\n}\n", v, len(args))
 		canFail = true
 	}
-	return canFail
+	return pos, canFail
 }
 
-func genResult(w io.Writer, arch arch, result string, loc string) {
+func genResult(w io.Writer, arch arch, result string, loc string, pos string) {
 	move := false
 	if result[0] == '@' {
 		// parse @block directive
@@ -515,9 +538,9 @@
 		result = s[1]
 		move = true
 	}
-	genResult0(w, arch, result, new(int), true, move, loc)
+	genResult0(w, arch, result, new(int), true, move, loc, pos)
 }
-func genResult0(w io.Writer, arch arch, result string, alloc *int, top, move bool, loc string) string {
+func genResult0(w io.Writer, arch arch, result string, alloc *int, top, move bool, loc string, pos string) string {
 	// TODO: when generating a constant result, use f.constVal to avoid
 	// introducing copies just to clean them up again.
 	if result[0] != '(' {
@@ -554,7 +577,7 @@
 		}
 		v = fmt.Sprintf("v%d", *alloc)
 		*alloc++
-		fmt.Fprintf(w, "%s := b.NewValue0(v.Pos, Op%s%s, %s)\n", v, oparch, op.name, typ)
+		fmt.Fprintf(w, "%s := b.NewValue0(%s, Op%s%s, %s)\n", v, pos, oparch, op.name, typ)
 		if move && top {
 			// Rewrite original into a copy
 			fmt.Fprintf(w, "v.reset(OpCopy)\n")
@@ -569,7 +592,7 @@
 		fmt.Fprintf(w, "%s.Aux = %s\n", v, aux)
 	}
 	for _, arg := range args {
-		x := genResult0(w, arch, arg, alloc, false, move, loc)
+		x := genResult0(w, arch, arg, alloc, false, move, loc, pos)
 		fmt.Fprintf(w, "%s.AddArg(%s)\n", v, x)
 	}
 
diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go
index 8946cf6..a265479 100644
--- a/src/cmd/compile/internal/ssa/regalloc.go
+++ b/src/cmd/compile/internal/ssa/regalloc.go
@@ -1220,6 +1220,13 @@
 					// This forces later liveness analysis to make the
 					// value live at this point.
 					v.SetArg(0, s.makeSpill(a, b))
+				} else if _, ok := a.Aux.(GCNode); ok && vi.rematerializeable {
+					// Rematerializeable value with a gc.Node. This is the address of
+					// a stack object (e.g. an LEAQ). Keep the object live.
+					// Change it to VarLive, which is what plive expects for locals.
+					v.Op = OpVarLive
+					v.SetArgs1(v.Args[1])
+					v.Aux = a.Aux
 				} else {
 					// In-register and rematerializeable values are already live.
 					// These are typically rematerializeable constants like nil,
diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go
index a154249..65d5098 100644
--- a/src/cmd/compile/internal/ssa/rewrite.go
+++ b/src/cmd/compile/internal/ssa/rewrite.go
@@ -1141,7 +1141,7 @@
 // read8 reads one byte from the read-only global sym at offset off.
 func read8(sym interface{}, off int64) uint8 {
 	lsym := sym.(*obj.LSym)
-	if off >= int64(len(lsym.P)) {
+	if off >= int64(len(lsym.P)) || off < 0 {
 		// Invalid index into the global sym.
 		// This can happen in dead code, so we don't want to panic.
 		// Just return any value, it will eventually get ignored.
@@ -1154,7 +1154,7 @@
 // read16 reads two bytes from the read-only global sym at offset off.
 func read16(sym interface{}, off int64, bigEndian bool) uint16 {
 	lsym := sym.(*obj.LSym)
-	if off >= int64(len(lsym.P))-1 {
+	if off >= int64(len(lsym.P))-1 || off < 0 {
 		return 0
 	}
 	if bigEndian {
@@ -1167,7 +1167,7 @@
 // read32 reads four bytes from the read-only global sym at offset off.
 func read32(sym interface{}, off int64, bigEndian bool) uint32 {
 	lsym := sym.(*obj.LSym)
-	if off >= int64(len(lsym.P))-3 {
+	if off >= int64(len(lsym.P))-3 || off < 0 {
 		return 0
 	}
 	if bigEndian {
@@ -1180,7 +1180,7 @@
 // read64 reads eight bytes from the read-only global sym at offset off.
 func read64(sym interface{}, off int64, bigEndian bool) uint64 {
 	lsym := sym.(*obj.LSym)
-	if off >= int64(len(lsym.P))-7 {
+	if off >= int64(len(lsym.P))-7 || off < 0 {
 		return 0
 	}
 	if bigEndian {
diff --git a/src/cmd/compile/internal/ssa/rewrite386.go b/src/cmd/compile/internal/ssa/rewrite386.go
index b6fb6c8..75b6de8 100644
--- a/src/cmd/compile/internal/ssa/rewrite386.go
+++ b/src/cmd/compile/internal/ssa/rewrite386.go
@@ -3197,7 +3197,7 @@
 			break
 		}
 		v.reset(Op386InvertFlags)
-		v0 := b.NewValue0(v.Pos, Op386CMPBload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, Op386CMPBload, types.TypeFlags)
 		v0.AuxInt = off
 		v0.Aux = sym
 		v0.AddArg(ptr)
@@ -3381,7 +3381,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, Op386CMPBconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, Op386CMPBconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(c, off)
@@ -3501,7 +3501,7 @@
 			break
 		}
 		v.reset(Op386InvertFlags)
-		v0 := b.NewValue0(v.Pos, Op386CMPLload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, Op386CMPLload, types.TypeFlags)
 		v0.AuxInt = off
 		v0.Aux = sym
 		v0.AddArg(ptr)
@@ -3704,7 +3704,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, Op386CMPLconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, Op386CMPLconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(c, off)
@@ -3824,7 +3824,7 @@
 			break
 		}
 		v.reset(Op386InvertFlags)
-		v0 := b.NewValue0(v.Pos, Op386CMPWload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, Op386CMPWload, types.TypeFlags)
 		v0.AuxInt = off
 		v0.Aux = sym
 		v0.AddArg(ptr)
@@ -4008,7 +4008,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, Op386CMPWconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, Op386CMPWconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(c, off)
@@ -4957,7 +4957,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, Op386MOVBLSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, Op386MOVBLSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -5062,7 +5062,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, Op386MOVBload, v.Type)
+		v0 := b.NewValue0(x.Pos, Op386MOVBload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -10726,7 +10726,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, Op386MOVWLSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, Op386MOVWLSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -10831,7 +10831,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, Op386MOVWload, v.Type)
+		v0 := b.NewValue0(x.Pos, Op386MOVWload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -14209,7 +14209,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
+		v0 := b.NewValue0(x1.Pos, Op386MOVWload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14258,7 +14258,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
+		v0 := b.NewValue0(x0.Pos, Op386MOVWload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14334,7 +14334,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14410,7 +14410,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14486,7 +14486,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x1.Pos, Op386MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14562,7 +14562,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x0.Pos, Op386MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go
index 43d77c9..b52e53f 100644
--- a/src/cmd/compile/internal/ssa/rewriteAMD64.go
+++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go
@@ -2197,7 +2197,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ADDL)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLf2i, typ.UInt32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLf2i, typ.UInt32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -3158,7 +3158,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ADDQ)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQf2i, typ.UInt64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQf2i, typ.UInt64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -3360,7 +3360,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ADDSD)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQi2f, typ.Float64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQi2f, typ.Float64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -3506,7 +3506,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ADDSS)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLi2f, typ.Float32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLi2f, typ.Float32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -3971,7 +3971,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ANDL)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLf2i, typ.UInt32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLf2i, typ.UInt32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -4508,7 +4508,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ANDQ)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQf2i, typ.UInt64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQf2i, typ.UInt64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -8876,7 +8876,7 @@
 			break
 		}
 		v.reset(OpAMD64InvertFlags)
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPBload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPBload, types.TypeFlags)
 		v0.AuxInt = off
 		v0.Aux = sym
 		v0.AddArg(ptr)
@@ -9054,7 +9054,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPBconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPBconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(c, off)
@@ -9279,7 +9279,7 @@
 			break
 		}
 		v.reset(OpAMD64InvertFlags)
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPLload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPLload, types.TypeFlags)
 		v0.AuxInt = off
 		v0.Aux = sym
 		v0.AddArg(ptr)
@@ -9476,7 +9476,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPLconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPLconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(c, off)
@@ -9707,7 +9707,7 @@
 			break
 		}
 		v.reset(OpAMD64InvertFlags)
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPQload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPQload, types.TypeFlags)
 		v0.AuxInt = off
 		v0.Aux = sym
 		v0.AddArg(ptr)
@@ -10021,7 +10021,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPQconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPQconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(c, off)
@@ -10246,7 +10246,7 @@
 			break
 		}
 		v.reset(OpAMD64InvertFlags)
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPWload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPWload, types.TypeFlags)
 		v0.AuxInt = off
 		v0.Aux = sym
 		v0.AddArg(ptr)
@@ -10424,7 +10424,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPWconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPWconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(c, off)
@@ -12054,7 +12054,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12080,7 +12080,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12106,7 +12106,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12132,7 +12132,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12246,7 +12246,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12272,7 +12272,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12298,7 +12298,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12324,7 +12324,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVBload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVBload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -13256,7 +13256,7 @@
 		v.AuxInt = i - 1
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64ROLWconst, w.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ROLWconst, w.Type)
 		v0.AuxInt = 8
 		v0.AddArg(w)
 		v.AddArg(v0)
@@ -13352,7 +13352,7 @@
 		v.AuxInt = i - 3
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPL, w.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64BSWAPL, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -13550,7 +13550,7 @@
 		v.AuxInt = i - 7
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPQ, w.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64BSWAPQ, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -13984,7 +13984,7 @@
 		v.AuxInt = i - 1
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v0 := b.NewValue0(x2.Pos, OpAMD64MOVWload, typ.UInt16)
 		v0.AuxInt = j - 1
 		v0.Aux = s2
 		v0.AddArg(p2)
@@ -15099,7 +15099,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVLQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15125,7 +15125,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVLQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15265,7 +15265,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVLload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15291,7 +15291,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVLload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -16657,7 +16657,7 @@
 		v.AuxInt = i - 4
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQload, typ.UInt64)
+		v0 := b.NewValue0(x2.Pos, OpAMD64MOVQload, typ.UInt64)
 		v0.AuxInt = j - 4
 		v0.Aux = s2
 		v0.AddArg(p2)
@@ -17851,7 +17851,7 @@
 		v.AuxInt = ValAndOff(a).Off()
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQconst, typ.UInt64)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVQconst, typ.UInt64)
 		v0.AuxInt = ValAndOff(a).Val()&0xffffffff | ValAndOff(c).Val()<<32
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -17885,7 +17885,7 @@
 		v.AuxInt = ValAndOff(a).Off()
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQconst, typ.UInt64)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVQconst, typ.UInt64)
 		v0.AuxInt = ValAndOff(a).Val()&0xffffffff | ValAndOff(c).Val()<<32
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -20804,7 +20804,7 @@
 		v.AuxInt = ValAndOff(c2).Off()
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVOconst, types.TypeInt128)
 		v0.AuxInt = 0
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -22627,7 +22627,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVWQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -22653,7 +22653,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVWQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -22679,7 +22679,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWQSXload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVWQSXload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -22806,7 +22806,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVWload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -22832,7 +22832,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVWload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -22858,7 +22858,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpAMD64MOVWload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -23981,7 +23981,7 @@
 		v.AuxInt = i - 2
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x2.Pos, OpAMD64MOVLload, typ.UInt32)
 		v0.AuxInt = j - 2
 		v0.Aux = s2
 		v0.AddArg(p2)
@@ -26300,7 +26300,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64MULSD)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQi2f, typ.Float64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQi2f, typ.Float64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -26446,7 +26446,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64MULSS)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLi2f, typ.Float32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLi2f, typ.Float32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -29975,7 +29975,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v0 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -30024,7 +30024,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v0 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -30073,7 +30073,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -30122,7 +30122,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -30180,12 +30180,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -30244,12 +30244,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -30308,12 +30308,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -30379,12 +30379,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -32423,11 +32423,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ROLWconst, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ROLWconst, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 8
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v1 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -32475,11 +32475,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ROLWconst, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ROLWconst, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 8
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v1 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -32541,10 +32541,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPL, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64BSWAPL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v1 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -32606,10 +32606,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPL, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64BSWAPL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v1 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -32666,14 +32666,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -32733,14 +32733,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -32800,14 +32800,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -32874,14 +32874,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORL, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLLconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLLconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -35364,7 +35364,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ORL)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLf2i, typ.UInt32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLf2i, typ.UInt32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -36784,7 +36784,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v0 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -36833,7 +36833,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v0 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -36882,7 +36882,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -36931,7 +36931,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v0 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -36980,7 +36980,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQload, typ.UInt64)
+		v0 := b.NewValue0(x1.Pos, OpAMD64MOVQload, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -37036,7 +37036,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQload, typ.UInt64)
+		v0 := b.NewValue0(x0.Pos, OpAMD64MOVQload, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -37094,12 +37094,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -37158,12 +37158,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -37222,12 +37222,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -37286,12 +37286,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -37350,12 +37350,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -37414,12 +37414,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -37478,12 +37478,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -37542,12 +37542,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -41143,11 +41143,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ROLWconst, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ROLWconst, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 8
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v1 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -41195,11 +41195,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ROLWconst, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ROLWconst, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 8
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v1 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -41261,10 +41261,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPL, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64BSWAPL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v1 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -41326,10 +41326,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPL, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64BSWAPL, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v1 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -41385,10 +41385,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64BSWAPQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVQload, typ.UInt64)
+		v1 := b.NewValue0(x0.Pos, OpAMD64MOVQload, typ.UInt64)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -41451,10 +41451,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64BSWAPQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64BSWAPQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64MOVQload, typ.UInt64)
+		v1 := b.NewValue0(x1.Pos, OpAMD64MOVQload, typ.UInt64)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -41511,14 +41511,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -41578,14 +41578,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x1.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -41645,14 +41645,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -41712,14 +41712,14 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64ROLWconst, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpAMD64ROLWconst, typ.UInt16)
 		v2.AuxInt = 8
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
+		v3 := b.NewValue0(x0.Pos, OpAMD64MOVWload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -41793,13 +41793,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64BSWAPL, typ.UInt32)
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpAMD64BSWAPL, typ.UInt32)
+		v3 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -41873,13 +41873,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64BSWAPL, typ.UInt32)
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpAMD64BSWAPL, typ.UInt32)
+		v3 := b.NewValue0(x1.Pos, OpAMD64MOVLload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -41953,13 +41953,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64BSWAPL, typ.UInt32)
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpAMD64BSWAPL, typ.UInt32)
+		v3 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -42033,13 +42033,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpAMD64ORQ, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpAMD64ORQ, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpAMD64SHLQconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpAMD64SHLQconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpAMD64BSWAPL, typ.UInt32)
-		v3 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpAMD64BSWAPL, typ.UInt32)
+		v3 := b.NewValue0(x0.Pos, OpAMD64MOVLload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -46413,7 +46413,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64ORQ)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQf2i, typ.UInt64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQf2i, typ.UInt64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -55238,7 +55238,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64SUBL)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLf2i, typ.UInt32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLf2i, typ.UInt32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -55554,7 +55554,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64SUBQ)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQf2i, typ.UInt64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQf2i, typ.UInt64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -55730,7 +55730,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64SUBSD)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQi2f, typ.Float64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQi2f, typ.Float64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -55850,7 +55850,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64SUBSS)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLi2f, typ.Float32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLi2f, typ.Float32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -55911,7 +55911,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPBconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPBconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -55939,7 +55939,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPBconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPBconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -56023,7 +56023,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPLconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPLconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -56051,7 +56051,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPLconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPLconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -56141,7 +56141,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPQconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPQconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -56169,7 +56169,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPQconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPQconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -56253,7 +56253,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPWconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPWconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -56281,7 +56281,7 @@
 			break
 		}
 		b = l.Block
-		v0 := b.NewValue0(v.Pos, OpAMD64CMPWconstload, types.TypeFlags)
+		v0 := b.NewValue0(l.Pos, OpAMD64CMPWconstload, types.TypeFlags)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = makeValAndOff(0, off)
@@ -57226,7 +57226,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64XORL)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVLf2i, typ.UInt32)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVLf2i, typ.UInt32)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -57764,7 +57764,7 @@
 		y := v_2.Args[1]
 		v.reset(OpAMD64XORQ)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpAMD64MOVQf2i, typ.UInt64)
+		v0 := b.NewValue0(v_2.Pos, OpAMD64MOVQf2i, typ.UInt64)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
diff --git a/src/cmd/compile/internal/ssa/rewriteARM64.go b/src/cmd/compile/internal/ssa/rewriteARM64.go
index 1e4b1ef..2afd0f3 100644
--- a/src/cmd/compile/internal/ssa/rewriteARM64.go
+++ b/src/cmd/compile/internal/ssa/rewriteARM64.go
@@ -10466,7 +10466,7 @@
 		v.AuxInt = i - 7
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, w.Type)
+		v0 := b.NewValue0(x6.Pos, OpARM64REV, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -10655,7 +10655,7 @@
 		v.reset(OpARM64MOVDstoreidx)
 		v.AddArg(ptr0)
 		v.AddArg(idx0)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, w.Type)
+		v0 := b.NewValue0(x5.Pos, OpARM64REV, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -10750,7 +10750,7 @@
 		v.AuxInt = i - 3
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, w.Type)
+		v0 := b.NewValue0(x2.Pos, OpARM64REVW, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -10843,7 +10843,7 @@
 		v.reset(OpARM64MOVWstoreidx)
 		v.AddArg(ptr0)
 		v.AddArg(idx0)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, w.Type)
+		v0 := b.NewValue0(x1.Pos, OpARM64REVW, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -10950,7 +10950,7 @@
 		v.AuxInt = i - 3
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, w.Type)
+		v0 := b.NewValue0(x2.Pos, OpARM64REVW, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11055,7 +11055,7 @@
 		v.reset(OpARM64MOVWstoreidx)
 		v.AddArg(ptr0)
 		v.AddArg(idx0)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, w.Type)
+		v0 := b.NewValue0(x1.Pos, OpARM64REVW, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11155,7 +11155,7 @@
 		v.AuxInt = i - 3
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, w.Type)
+		v0 := b.NewValue0(x2.Pos, OpARM64REVW, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11248,7 +11248,7 @@
 		v.reset(OpARM64MOVWstoreidx)
 		v.AddArg(ptr0)
 		v.AddArg(idx0)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, w.Type)
+		v0 := b.NewValue0(x1.Pos, OpARM64REVW, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11295,7 +11295,7 @@
 		v.AuxInt = i - 1
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REV16W, w.Type)
+		v0 := b.NewValue0(x.Pos, OpARM64REV16W, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11389,7 +11389,7 @@
 		v.AuxInt = i - 1
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REV16W, w.Type)
+		v0 := b.NewValue0(x.Pos, OpARM64REV16W, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11487,7 +11487,7 @@
 		v.AuxInt = i - 1
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REV16W, w.Type)
+		v0 := b.NewValue0(x.Pos, OpARM64REV16W, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11585,7 +11585,7 @@
 		v.AuxInt = i - 1
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REV16W, w.Type)
+		v0 := b.NewValue0(x.Pos, OpARM64REV16W, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -11688,7 +11688,7 @@
 		v.AuxInt = i - 1
 		v.Aux = s
 		v.AddArg(ptr)
-		v0 := b.NewValue0(v.Pos, OpARM64REV16W, w.Type)
+		v0 := b.NewValue0(x.Pos, OpARM64REV16W, w.Type)
 		v0.AddArg(w)
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -21981,11 +21981,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVWUload, t)
+		v0 := b.NewValue0(x3.Pos, OpARM64MOVWUload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.Aux = s
-		v1 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v1 := b.NewValue0(x3.Pos, OpOffPtr, p.Type)
 		v1.AuxInt = i0
 		v1.AddArg(p)
 		v0.AddArg(v1)
@@ -22095,11 +22095,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVWUload, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64MOVWUload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.Aux = s
-		v1 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v1 := b.NewValue0(x2.Pos, OpOffPtr, p.Type)
 		v1.AuxInt = i0
 		v1.AddArg(p)
 		v0.AddArg(v1)
@@ -22214,7 +22214,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVWUloadidx, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64MOVWUloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
@@ -22330,7 +22330,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVWUloadidx, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64MOVWUloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
@@ -22805,11 +22805,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpARM64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.Aux = s
-		v1 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v1 := b.NewValue0(x7.Pos, OpOffPtr, p.Type)
 		v1.AuxInt = i0
 		v1.AddArg(p)
 		v0.AddArg(v1)
@@ -23032,11 +23032,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVDload, t)
+		v0 := b.NewValue0(x6.Pos, OpARM64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.Aux = s
-		v1 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v1 := b.NewValue0(x6.Pos, OpOffPtr, p.Type)
 		v1.AuxInt = i0
 		v1.AddArg(p)
 		v0.AddArg(v1)
@@ -23267,7 +23267,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVDloadidx, t)
+		v0 := b.NewValue0(x6.Pos, OpARM64MOVDloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
@@ -23499,7 +23499,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVDloadidx, t)
+		v0 := b.NewValue0(x6.Pos, OpARM64MOVDloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
@@ -24130,12 +24130,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, t)
+		v0 := b.NewValue0(x3.Pos, OpARM64REVW, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVWUload, t)
+		v1 := b.NewValue0(x3.Pos, OpARM64MOVWUload, t)
 		v1.Aux = s
-		v2 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v2 := b.NewValue0(x3.Pos, OpOffPtr, p.Type)
 		v2.AuxInt = i0
 		v2.AddArg(p)
 		v1.AddArg(v2)
@@ -24246,12 +24246,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64REVW, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVWUload, t)
+		v1 := b.NewValue0(x2.Pos, OpARM64MOVWUload, t)
 		v1.Aux = s
-		v2 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v2 := b.NewValue0(x2.Pos, OpOffPtr, p.Type)
 		v2.AuxInt = i0
 		v2.AddArg(p)
 		v1.AddArg(v2)
@@ -24367,10 +24367,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, t)
+		v0 := b.NewValue0(x3.Pos, OpARM64REVW, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVWUloadidx, t)
+		v1 := b.NewValue0(x3.Pos, OpARM64MOVWUloadidx, t)
 		v1.AddArg(ptr0)
 		v1.AddArg(idx0)
 		v1.AddArg(mem)
@@ -24485,10 +24485,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64REVW, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVWUloadidx, t)
+		v1 := b.NewValue0(x2.Pos, OpARM64MOVWUloadidx, t)
 		v1.AddArg(ptr0)
 		v1.AddArg(idx0)
 		v1.AddArg(mem)
@@ -24971,12 +24971,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, t)
+		v0 := b.NewValue0(x7.Pos, OpARM64REV, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVDload, t)
+		v1 := b.NewValue0(x7.Pos, OpARM64MOVDload, t)
 		v1.Aux = s
-		v2 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v2 := b.NewValue0(x7.Pos, OpOffPtr, p.Type)
 		v2.AuxInt = i0
 		v2.AddArg(p)
 		v1.AddArg(v2)
@@ -25195,12 +25195,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, t)
+		v0 := b.NewValue0(x6.Pos, OpARM64REV, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVDload, t)
+		v1 := b.NewValue0(x6.Pos, OpARM64MOVDload, t)
 		v1.Aux = s
-		v2 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v2 := b.NewValue0(x6.Pos, OpOffPtr, p.Type)
 		v2.AuxInt = i0
 		v2.AddArg(p)
 		v1.AddArg(v2)
@@ -25432,10 +25432,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, t)
+		v0 := b.NewValue0(x7.Pos, OpARM64REV, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVDloadidx, t)
+		v1 := b.NewValue0(x7.Pos, OpARM64MOVDloadidx, t)
 		v1.AddArg(ptr0)
 		v1.AddArg(idx0)
 		v1.AddArg(mem)
@@ -25666,10 +25666,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, t)
+		v0 := b.NewValue0(x6.Pos, OpARM64REV, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVDloadidx, t)
+		v1 := b.NewValue0(x6.Pos, OpARM64MOVDloadidx, t)
 		v1.AddArg(ptr0)
 		v1.AddArg(idx0)
 		v1.AddArg(mem)
@@ -26726,11 +26726,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVHUload, t)
+		v0 := b.NewValue0(x1.Pos, OpARM64MOVHUload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.Aux = s
-		v1 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v1 := b.NewValue0(x1.Pos, OpOffPtr, p.Type)
 		v1.AuxInt = i0
 		v1.AddArg(p)
 		v0.AddArg(v1)
@@ -26785,7 +26785,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVHUloadidx, t)
+		v0 := b.NewValue0(x1.Pos, OpARM64MOVHUloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
@@ -26924,11 +26924,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVWUload, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64MOVWUload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.Aux = s
-		v1 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v1 := b.NewValue0(x2.Pos, OpOffPtr, p.Type)
 		v1.AuxInt = i0
 		v1.AddArg(p)
 		v0.AddArg(v1)
@@ -27006,7 +27006,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVWUloadidx, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64MOVWUloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
@@ -27175,11 +27175,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVWUloadidx, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64MOVWUloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
-		v1 := b.NewValue0(v.Pos, OpARM64SLLconst, idx0.Type)
+		v1 := b.NewValue0(x2.Pos, OpARM64SLLconst, idx0.Type)
 		v1.AuxInt = 1
 		v1.AddArg(idx0)
 		v0.AddArg(v1)
@@ -27308,11 +27308,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVDload, t)
+		v0 := b.NewValue0(x4.Pos, OpARM64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.Aux = s
-		v1 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v1 := b.NewValue0(x4.Pos, OpOffPtr, p.Type)
 		v1.AuxInt = i0
 		v1.AddArg(p)
 		v0.AddArg(v1)
@@ -27448,7 +27448,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVDloadidx, t)
+		v0 := b.NewValue0(x4.Pos, OpARM64MOVDloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
@@ -27588,11 +27588,11 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpARM64MOVDloadidx, t)
+		v0 := b.NewValue0(x4.Pos, OpARM64MOVDloadidx, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AddArg(ptr0)
-		v1 := b.NewValue0(v.Pos, OpARM64SLLconst, idx0.Type)
+		v1 := b.NewValue0(x4.Pos, OpARM64SLLconst, idx0.Type)
 		v1.AuxInt = 2
 		v1.AddArg(idx0)
 		v0.AddArg(v1)
@@ -27797,10 +27797,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpARM64REV16W, t)
+		v0 := b.NewValue0(x1.Pos, OpARM64REV16W, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVHUload, t)
+		v1 := b.NewValue0(x1.Pos, OpARM64MOVHUload, t)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -27861,10 +27861,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpARM64REV16W, t)
+		v0 := b.NewValue0(x0.Pos, OpARM64REV16W, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVHUloadidx, t)
+		v1 := b.NewValue0(x0.Pos, OpARM64MOVHUloadidx, t)
 		v1.AddArg(ptr0)
 		v1.AddArg(idx0)
 		v1.AddArg(mem)
@@ -28003,12 +28003,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, t)
+		v0 := b.NewValue0(x2.Pos, OpARM64REVW, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVWUload, t)
+		v1 := b.NewValue0(x2.Pos, OpARM64MOVWUload, t)
 		v1.Aux = s
-		v2 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v2 := b.NewValue0(x2.Pos, OpOffPtr, p.Type)
 		v2.AuxInt = i0
 		v2.AddArg(p)
 		v1.AddArg(v2)
@@ -28091,10 +28091,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpARM64REVW, t)
+		v0 := b.NewValue0(x1.Pos, OpARM64REVW, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVWUloadidx, t)
+		v1 := b.NewValue0(x1.Pos, OpARM64MOVWUloadidx, t)
 		v1.AddArg(ptr0)
 		v1.AddArg(idx0)
 		v1.AddArg(mem)
@@ -28320,12 +28320,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, t)
+		v0 := b.NewValue0(x4.Pos, OpARM64REV, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVDload, t)
+		v1 := b.NewValue0(x4.Pos, OpARM64MOVDload, t)
 		v1.Aux = s
-		v2 := b.NewValue0(v.Pos, OpOffPtr, p.Type)
+		v2 := b.NewValue0(x4.Pos, OpOffPtr, p.Type)
 		v2.AuxInt = i0
 		v2.AddArg(p)
 		v1.AddArg(v2)
@@ -28466,10 +28466,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpARM64REV, t)
+		v0 := b.NewValue0(x3.Pos, OpARM64REV, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpARM64MOVDloadidx, t)
+		v1 := b.NewValue0(x3.Pos, OpARM64MOVDloadidx, t)
 		v1.AddArg(ptr0)
 		v1.AddArg(idx0)
 		v1.AddArg(mem)
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go
index 951c5a5..55bef5a 100644
--- a/src/cmd/compile/internal/ssa/rewriteMIPS.go
+++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go
@@ -3502,7 +3502,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpMIPSMOVBUload, t)
+		v0 := b.NewValue0(x.Pos, OpMIPSMOVBUload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -3663,7 +3663,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpMIPSMOVBload, t)
+		v0 := b.NewValue0(x.Pos, OpMIPSMOVBload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -4359,7 +4359,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpMIPSMOVHUload, t)
+		v0 := b.NewValue0(x.Pos, OpMIPSMOVHUload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -4570,7 +4570,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpMIPSMOVHload, t)
+		v0 := b.NewValue0(x.Pos, OpMIPSMOVHload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
diff --git a/src/cmd/compile/internal/ssa/rewritePPC64.go b/src/cmd/compile/internal/ssa/rewritePPC64.go
index 9c89e0e..fdb34ae 100644
--- a/src/cmd/compile/internal/ssa/rewritePPC64.go
+++ b/src/cmd/compile/internal/ssa/rewritePPC64.go
@@ -7541,7 +7541,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, typ.Int64)
+		v0 := b.NewValue0(x.Pos, OpPPC64MOVDload, typ.Int64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -8477,7 +8477,7 @@
 		v.AuxInt = i0
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt16)
+		v0 := b.NewValue0(x0.Pos, OpPPC64SRWconst, typ.UInt16)
 		v0.AuxInt = 16
 		v0.AddArg(w)
 		v.AddArg(v0)
@@ -8530,7 +8530,7 @@
 		v.AuxInt = i0
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt16)
+		v0 := b.NewValue0(x0.Pos, OpPPC64SRWconst, typ.UInt16)
 		v0.AuxInt = 16
 		v0.AddArg(w)
 		v.AddArg(v0)
@@ -8703,7 +8703,7 @@
 			break
 		}
 		v.reset(OpPPC64MOVWBRstore)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v0.AuxInt = i0
 		v0.Aux = s
 		v0.AddArg(p)
@@ -8748,7 +8748,7 @@
 			break
 		}
 		v.reset(OpPPC64MOVHBRstore)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v0.AuxInt = i0
 		v0.Aux = s
 		v0.AddArg(p)
@@ -9043,7 +9043,7 @@
 			break
 		}
 		v.reset(OpPPC64MOVDBRstore)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v0.AuxInt = i0
 		v0.Aux = s
 		v0.AddArg(p)
@@ -12470,7 +12470,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpPPC64FMOVDload, typ.Float64)
+		v0 := b.NewValue0(x.Pos, OpPPC64FMOVDload, typ.Float64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -13048,7 +13048,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVHZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -13098,7 +13098,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVHZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -13148,7 +13148,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVHZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -13198,7 +13198,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVHZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -13248,10 +13248,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -13300,10 +13300,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVHBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -13352,10 +13352,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -13404,10 +13404,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVHBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -13468,12 +13468,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = n1
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
+		v2 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -13526,12 +13526,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = n1
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVHBRload, t)
+		v2 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -13584,12 +13584,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = n1
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
+		v2 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -13642,12 +13642,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = n1
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVHBRload, t)
+		v2 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -13727,7 +13727,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -13807,7 +13807,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -13887,7 +13887,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -13967,7 +13967,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14047,7 +14047,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14127,7 +14127,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14216,7 +14216,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14296,7 +14296,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -14386,10 +14386,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -14478,10 +14478,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -14570,10 +14570,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -14662,10 +14662,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -14754,10 +14754,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -14846,10 +14846,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -14938,10 +14938,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15030,10 +15030,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15131,10 +15131,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15223,10 +15223,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15315,10 +15315,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15407,10 +15407,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15499,10 +15499,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15591,10 +15591,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15683,10 +15683,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15775,10 +15775,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -15874,12 +15874,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -15976,12 +15976,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -16087,12 +16087,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -16189,12 +16189,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -16291,12 +16291,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -16393,12 +16393,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -16495,12 +16495,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -16597,12 +16597,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2)
-		v0 := b.NewValue0(v.Pos, OpPPC64SLDconst, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64SLDconst, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = 32
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRload, t)
-		v2 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
+		v2 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -16742,7 +16742,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -16882,7 +16882,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x4.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -17022,7 +17022,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x5.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -17162,7 +17162,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x5.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -17309,7 +17309,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -17449,7 +17449,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -17589,7 +17589,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -17729,7 +17729,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -17869,7 +17869,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -18009,7 +18009,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -18149,7 +18149,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -18289,7 +18289,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -18429,7 +18429,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -18569,7 +18569,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -18718,7 +18718,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -18858,7 +18858,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -19005,10 +19005,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x4.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x4.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -19154,10 +19154,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x3.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x3.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -19303,10 +19303,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -19452,10 +19452,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x2.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -19601,10 +19601,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -19750,10 +19750,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -19899,10 +19899,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -20048,10 +20048,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x1.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -20206,10 +20206,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -20355,10 +20355,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -20504,10 +20504,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -20653,10 +20653,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -20802,10 +20802,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -20951,10 +20951,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -21100,10 +21100,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -21249,10 +21249,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1, x2, x3, x4)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x0.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -21401,10 +21401,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x3.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x3.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -21553,10 +21553,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x4.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x4.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -21714,10 +21714,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x5.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x5.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -21866,10 +21866,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x5.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x5.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -22018,10 +22018,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -22170,10 +22170,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -22322,10 +22322,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -22474,10 +22474,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -22626,10 +22626,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -22778,10 +22778,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -22930,10 +22930,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -23082,10 +23082,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -23243,10 +23243,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -23395,10 +23395,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -23547,10 +23547,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -23699,10 +23699,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -23851,10 +23851,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x3.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x3.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -24003,10 +24003,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x4.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x4.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -24155,10 +24155,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x5.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x5.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -24307,10 +24307,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x5.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x5.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -24459,10 +24459,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -24611,10 +24611,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -24772,10 +24772,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -24924,10 +24924,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x6.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -25076,10 +25076,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -25228,10 +25228,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -25380,10 +25380,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -25532,10 +25532,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -25684,10 +25684,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -25836,10 +25836,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -25988,10 +25988,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -26140,10 +26140,10 @@
 			break
 		}
 		b = mergePoint(b, x3, x4, x5, x6, x7)
-		v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRload, t)
+		v0 := b.NewValue0(x7.Pos, OpPPC64MOVDBRload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, typ.Uintptr)
+		v1 := b.NewValue0(x7.Pos, OpPPC64MOVDaddr, typ.Uintptr)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -30296,12 +30296,13 @@
 	}
 }
 func rewriteValuePPC64_OpTrunc16to8_0(v *Value) bool {
-	// match: (Trunc16to8 x)
-	// cond: isSigned(x.Type)
+	// match: (Trunc16to8 <t> x)
+	// cond: isSigned(t)
 	// result: (MOVBreg x)
 	for {
+		t := v.Type
 		x := v.Args[0]
-		if !(isSigned(x.Type)) {
+		if !(isSigned(t)) {
 			break
 		}
 		v.reset(OpPPC64MOVBreg)
@@ -30319,12 +30320,13 @@
 	}
 }
 func rewriteValuePPC64_OpTrunc32to16_0(v *Value) bool {
-	// match: (Trunc32to16 x)
-	// cond: isSigned(x.Type)
+	// match: (Trunc32to16 <t> x)
+	// cond: isSigned(t)
 	// result: (MOVHreg x)
 	for {
+		t := v.Type
 		x := v.Args[0]
-		if !(isSigned(x.Type)) {
+		if !(isSigned(t)) {
 			break
 		}
 		v.reset(OpPPC64MOVHreg)
@@ -30342,12 +30344,13 @@
 	}
 }
 func rewriteValuePPC64_OpTrunc32to8_0(v *Value) bool {
-	// match: (Trunc32to8 x)
-	// cond: isSigned(x.Type)
+	// match: (Trunc32to8 <t> x)
+	// cond: isSigned(t)
 	// result: (MOVBreg x)
 	for {
+		t := v.Type
 		x := v.Args[0]
-		if !(isSigned(x.Type)) {
+		if !(isSigned(t)) {
 			break
 		}
 		v.reset(OpPPC64MOVBreg)
@@ -30365,12 +30368,13 @@
 	}
 }
 func rewriteValuePPC64_OpTrunc64to16_0(v *Value) bool {
-	// match: (Trunc64to16 x)
-	// cond: isSigned(x.Type)
+	// match: (Trunc64to16 <t> x)
+	// cond: isSigned(t)
 	// result: (MOVHreg x)
 	for {
+		t := v.Type
 		x := v.Args[0]
-		if !(isSigned(x.Type)) {
+		if !(isSigned(t)) {
 			break
 		}
 		v.reset(OpPPC64MOVHreg)
@@ -30388,12 +30392,13 @@
 	}
 }
 func rewriteValuePPC64_OpTrunc64to32_0(v *Value) bool {
-	// match: (Trunc64to32 x)
-	// cond: isSigned(x.Type)
+	// match: (Trunc64to32 <t> x)
+	// cond: isSigned(t)
 	// result: (MOVWreg x)
 	for {
+		t := v.Type
 		x := v.Args[0]
-		if !(isSigned(x.Type)) {
+		if !(isSigned(t)) {
 			break
 		}
 		v.reset(OpPPC64MOVWreg)
@@ -30411,12 +30416,13 @@
 	}
 }
 func rewriteValuePPC64_OpTrunc64to8_0(v *Value) bool {
-	// match: (Trunc64to8 x)
-	// cond: isSigned(x.Type)
+	// match: (Trunc64to8 <t> x)
+	// cond: isSigned(t)
 	// result: (MOVBreg x)
 	for {
+		t := v.Type
 		x := v.Args[0]
-		if !(isSigned(x.Type)) {
+		if !(isSigned(t)) {
 			break
 		}
 		v.reset(OpPPC64MOVBreg)
diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go
index 1695b08..ce501a7 100644
--- a/src/cmd/compile/internal/ssa/rewriteS390X.go
+++ b/src/cmd/compile/internal/ssa/rewriteS390X.go
@@ -7837,7 +7837,7 @@
 		}
 		v.reset(OpS390XADD)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpS390XLGDR, t)
+		v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -8756,7 +8756,7 @@
 		}
 		v.reset(OpS390XAND)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpS390XLGDR, t)
+		v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -10884,11 +10884,11 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XLNDFR, t)
+		v0 := b.NewValue0(x.Pos, OpS390XLNDFR, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XLDGR, t)
-		v2 := b.NewValue0(v.Pos, OpS390XMOVDload, t1)
+		v1 := b.NewValue0(x.Pos, OpS390XLDGR, t)
+		v2 := b.NewValue0(x.Pos, OpS390XMOVDload, t1)
 		v2.AuxInt = off
 		v2.Aux = sym
 		v2.AddArg(ptr)
@@ -11539,7 +11539,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -11565,7 +11565,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -11979,7 +11979,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -12005,7 +12005,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15359,7 +15359,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15386,7 +15386,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15413,7 +15413,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15440,7 +15440,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15467,7 +15467,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15494,7 +15494,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15521,7 +15521,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15800,7 +15800,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15827,7 +15827,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVBload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVBload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15854,7 +15854,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15881,7 +15881,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15908,7 +15908,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15935,7 +15935,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -15962,7 +15962,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDload, t)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVDload, t)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -17997,7 +17997,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -18023,7 +18023,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -18493,7 +18493,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -18526,7 +18526,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVHload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -19071,7 +19071,7 @@
 		v.AuxInt = ValAndOff(a).Off()
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVDconst, typ.UInt64)
 		v0.AuxInt = int64(int32(ValAndOff(c).Val()&0xffff | ValAndOff(a).Val()<<16))
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -20937,7 +20937,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -20968,7 +20968,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -21467,7 +21467,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -21493,7 +21493,7 @@
 			break
 		}
 		b = x.Block
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWload, v.Type)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVWload, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = off
@@ -22040,7 +22040,7 @@
 		v.AuxInt = ValAndOff(a).Off()
 		v.Aux = s
 		v.AddArg(p)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
+		v0 := b.NewValue0(x.Pos, OpS390XMOVDconst, typ.UInt64)
 		v0.AuxInt = ValAndOff(c).Val()&0xffffffff | ValAndOff(a).Val()<<32
 		v.AddArg(v0)
 		v.AddArg(mem)
@@ -22873,7 +22873,7 @@
 		}
 		v.reset(OpS390XMULLD)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpS390XLGDR, t)
+		v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -23963,7 +23963,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -24012,7 +24012,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -24061,7 +24061,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -24117,7 +24117,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVWZload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -24166,7 +24166,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVDload, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -24215,7 +24215,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVDload, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -24273,12 +24273,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -24337,12 +24337,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -24401,12 +24401,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -24465,12 +24465,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -24529,12 +24529,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVWZload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -24593,12 +24593,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVWZload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -24657,12 +24657,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -24728,12 +24728,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -28322,10 +28322,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v1 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -28373,10 +28373,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v1 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -28432,10 +28432,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVWZreg, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v1 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -28498,10 +28498,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVWZreg, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v1 := b.NewValue0(x0.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -28557,7 +28557,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDBRload, typ.UInt64)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVDBRload, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -28614,7 +28614,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVDBRload, typ.UInt64)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVDBRload, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -28672,13 +28672,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -28738,13 +28738,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -28804,13 +28804,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -28870,13 +28870,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -28944,13 +28944,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVWZreg, typ.UInt64)
+		v3 := b.NewValue0(x0.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -29018,13 +29018,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVWZreg, typ.UInt64)
+		v3 := b.NewValue0(x0.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -29092,13 +29092,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVWZreg, typ.UInt64)
+		v3 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -29173,13 +29173,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVWZreg, typ.UInt64)
+		v3 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -33455,7 +33455,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -33504,7 +33504,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -33553,7 +33553,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -33602,7 +33602,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVWZload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -33660,12 +33660,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -33724,12 +33724,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -33788,12 +33788,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -33859,12 +33859,12 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j1
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16)
 		v2.AuxInt = i0
 		v2.Aux = s
 		v2.AddArg(p)
@@ -35903,10 +35903,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v1 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -35954,10 +35954,10 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v1 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v1.AuxInt = i0
 		v1.Aux = s
 		v1.AddArg(p)
@@ -36013,7 +36013,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v0 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -36070,7 +36070,7 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XMOVWBRload, typ.UInt32)
+		v0 := b.NewValue0(x0.Pos, OpS390XMOVWBRload, typ.UInt32)
 		v.reset(OpCopy)
 		v.AddArg(v0)
 		v0.AuxInt = i0
@@ -36128,13 +36128,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -36194,13 +36194,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x0.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x0.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -36260,13 +36260,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -36333,13 +36333,13 @@
 			break
 		}
 		b = mergePoint(b, x0, x1)
-		v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type)
+		v0 := b.NewValue0(x1.Pos, OpS390XORW, v.Type)
 		v.reset(OpCopy)
 		v.AddArg(v0)
-		v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type)
+		v1 := b.NewValue0(x1.Pos, OpS390XSLWconst, v.Type)
 		v1.AuxInt = j0
-		v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
-		v3 := b.NewValue0(v.Pos, OpS390XMOVHBRload, typ.UInt16)
+		v2 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64)
+		v3 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16)
 		v3.AuxInt = i0
 		v3.Aux = s
 		v3.AddArg(p)
@@ -38624,7 +38624,7 @@
 		}
 		v.reset(OpS390XOR)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpS390XLGDR, t)
+		v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -40523,7 +40523,7 @@
 		}
 		v.reset(OpS390XSUB)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpS390XLGDR, t)
+		v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
@@ -41382,7 +41382,7 @@
 		}
 		v.reset(OpS390XXOR)
 		v.AddArg(x)
-		v0 := b.NewValue0(v.Pos, OpS390XLGDR, t)
+		v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
 		v0.AddArg(y)
 		v.AddArg(v0)
 		return true
diff --git a/src/cmd/compile/internal/ssa/rewritegeneric.go b/src/cmd/compile/internal/ssa/rewritegeneric.go
index 79f0fd4..f2c7529 100644
--- a/src/cmd/compile/internal/ssa/rewritegeneric.go
+++ b/src/cmd/compile/internal/ssa/rewritegeneric.go
@@ -27397,7 +27397,7 @@
 	config := b.Func.Config
 	_ = config
 	// match: (StaticCall {sym} s1:(Store _ (Const64 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem))))
-	// cond: isSameSym(sym,"runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst,src,sz,config) && clobber(s1) && clobber(s2) && clobber(s3)
+	// cond: isSameSym(sym,"runtime.memmove") && t.(*types.Type).IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst,src,sz,config) && clobber(s1) && clobber(s2) && clobber(s3)
 	// result: (Move {t.(*types.Type).Elem()} [sz] dst src mem)
 	for {
 		sym := v.Aux
@@ -27425,7 +27425,7 @@
 		_ = s3.Args[2]
 		dst := s3.Args[1]
 		mem := s3.Args[2]
-		if !(isSameSym(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1) && clobber(s2) && clobber(s3)) {
+		if !(isSameSym(sym, "runtime.memmove") && t.(*types.Type).IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1) && clobber(s2) && clobber(s3)) {
 			break
 		}
 		v.reset(OpMove)
@@ -27437,7 +27437,7 @@
 		return true
 	}
 	// match: (StaticCall {sym} s1:(Store _ (Const32 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem))))
-	// cond: isSameSym(sym,"runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst,src,sz,config) && clobber(s1) && clobber(s2) && clobber(s3)
+	// cond: isSameSym(sym,"runtime.memmove") && t.(*types.Type).IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst,src,sz,config) && clobber(s1) && clobber(s2) && clobber(s3)
 	// result: (Move {t.(*types.Type).Elem()} [sz] dst src mem)
 	for {
 		sym := v.Aux
@@ -27465,7 +27465,7 @@
 		_ = s3.Args[2]
 		dst := s3.Args[1]
 		mem := s3.Args[2]
-		if !(isSameSym(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1) && clobber(s2) && clobber(s3)) {
+		if !(isSameSym(sym, "runtime.memmove") && t.(*types.Type).IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1) && clobber(s2) && clobber(s3)) {
 			break
 		}
 		v.reset(OpMove)
diff --git a/src/cmd/compile/internal/ssa/writebarrier.go b/src/cmd/compile/internal/ssa/writebarrier.go
index 1024ab2..8cb41b2 100644
--- a/src/cmd/compile/internal/ssa/writebarrier.go
+++ b/src/cmd/compile/internal/ssa/writebarrier.go
@@ -196,6 +196,43 @@
 		// and simple store version to bElse
 		memThen := mem
 		memElse := mem
+
+		// If the source of a MoveWB is volatile (will be clobbered by a
+		// function call), we need to copy it to a temporary location, as
+		// marshaling the args of typedmemmove might clobber the value we're
+		// trying to move.
+		// Look for volatile source, copy it to temporary before we emit any
+		// call.
+		// It is unlikely to have more than one of them. Just do a linear
+		// search instead of using a map.
+		type volatileCopy struct {
+			src *Value // address of original volatile value
+			tmp *Value // address of temporary we've copied the volatile value into
+		}
+		var volatiles []volatileCopy
+	copyLoop:
+		for _, w := range stores {
+			if w.Op == OpMoveWB {
+				val := w.Args[1]
+				if isVolatile(val) {
+					for _, c := range volatiles {
+						if val == c.src {
+							continue copyLoop // already copied
+						}
+					}
+
+					t := val.Type.Elem()
+					tmp := f.fe.Auto(w.Pos, t)
+					memThen = bThen.NewValue1A(w.Pos, OpVarDef, types.TypeMem, tmp, memThen)
+					tmpaddr := bThen.NewValue2A(w.Pos, OpLocalAddr, t.PtrTo(), tmp, sp, memThen)
+					siz := t.Size()
+					memThen = bThen.NewValue3I(w.Pos, OpMove, types.TypeMem, siz, tmpaddr, val, memThen)
+					memThen.Aux = t
+					volatiles = append(volatiles, volatileCopy{val, tmpaddr})
+				}
+			}
+		}
+
 		for _, w := range stores {
 			ptr := w.Args[0]
 			pos := w.Pos
@@ -222,11 +259,19 @@
 			// then block: emit write barrier call
 			switch w.Op {
 			case OpStoreWB, OpMoveWB, OpZeroWB:
-				volatile := w.Op == OpMoveWB && isVolatile(val)
 				if w.Op == OpStoreWB {
 					memThen = bThen.NewValue3A(pos, OpWB, types.TypeMem, gcWriteBarrier, ptr, val, memThen)
 				} else {
-					memThen = wbcall(pos, bThen, fn, typ, ptr, val, memThen, sp, sb, volatile)
+					srcval := val
+					if w.Op == OpMoveWB && isVolatile(srcval) {
+						for _, c := range volatiles {
+							if srcval == c.src {
+								srcval = c.tmp
+								break
+							}
+						}
+					}
+					memThen = wbcall(pos, bThen, fn, typ, ptr, srcval, memThen, sp, sb)
 				}
 				// Note that we set up a writebarrier function call.
 				f.fe.SetWBPos(pos)
@@ -249,6 +294,12 @@
 			}
 		}
 
+		// mark volatile temps dead
+		for _, c := range volatiles {
+			tmpNode := c.tmp.Aux
+			memThen = bThen.NewValue1A(memThen.Pos, OpVarKill, types.TypeMem, tmpNode, memThen)
+		}
+
 		// merge memory
 		// Splice memory Phi into the last memory of the original sequence,
 		// which may be used in subsequent blocks. Other memories in the
@@ -302,25 +353,9 @@
 }
 
 // wbcall emits write barrier runtime call in b, returns memory.
-// if valIsVolatile, it moves val into temp space before making the call.
-func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value {
+func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Value) *Value {
 	config := b.Func.Config
 
-	var tmp GCNode
-	if valIsVolatile {
-		// Copy to temp location if the source is volatile (will be clobbered by
-		// a function call). Marshaling the args to typedmemmove might clobber the
-		// value we're trying to move.
-		t := val.Type.Elem()
-		tmp = b.Func.fe.Auto(val.Pos, t)
-		mem = b.NewValue1A(pos, OpVarDef, types.TypeMem, tmp, mem)
-		tmpaddr := b.NewValue2A(pos, OpLocalAddr, t.PtrTo(), tmp, sp, mem)
-		siz := t.Size()
-		mem = b.NewValue3I(pos, OpMove, types.TypeMem, siz, tmpaddr, val, mem)
-		mem.Aux = t
-		val = tmpaddr
-	}
-
 	// put arguments on stack
 	off := config.ctxt.FixedFrameSize()
 
@@ -348,11 +383,6 @@
 	// issue call
 	mem = b.NewValue1A(pos, OpStaticCall, types.TypeMem, fn, mem)
 	mem.AuxInt = off - config.ctxt.FixedFrameSize()
-
-	if valIsVolatile {
-		mem = b.NewValue1A(pos, OpVarKill, types.TypeMem, tmp, mem) // mark temp dead
-	}
-
 	return mem
 }
 
diff --git a/src/cmd/compile/internal/types/sym.go b/src/cmd/compile/internal/types/sym.go
index 86f5022..13761c7 100644
--- a/src/cmd/compile/internal/types/sym.go
+++ b/src/cmd/compile/internal/types/sym.go
@@ -79,9 +79,7 @@
 	}
 	if sym.Func() {
 		// This is a function symbol. Mark it as "internal ABI".
-		return Ctxt.LookupInit(sym.LinksymName(), func(s *obj.LSym) {
-			s.SetABI(obj.ABIInternal)
-		})
+		return Ctxt.LookupABI(sym.LinksymName(), obj.ABIInternal)
 	}
 	return Ctxt.Lookup(sym.LinksymName())
 }
diff --git a/src/cmd/compile/internal/wasm/ssa.go b/src/cmd/compile/internal/wasm/ssa.go
index 6e6dc55..897d614 100644
--- a/src/cmd/compile/internal/wasm/ssa.go
+++ b/src/cmd/compile/internal/wasm/ssa.go
@@ -20,6 +20,7 @@
 	arch.ZeroRange = zeroRange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 
 	arch.SSAMarkMoves = ssaMarkMoves
 	arch.SSAGenValue = ssaGenValue
diff --git a/src/cmd/compile/internal/x86/galign.go b/src/cmd/compile/internal/x86/galign.go
index 56cc6c6..7f53ee3 100644
--- a/src/cmd/compile/internal/x86/galign.go
+++ b/src/cmd/compile/internal/x86/galign.go
@@ -32,6 +32,7 @@
 	arch.ZeroRange = zerorange
 	arch.ZeroAuto = zeroAuto
 	arch.Ginsnop = ginsnop
+	arch.Ginsnopdefer = ginsnop
 
 	arch.SSAMarkMoves = ssaMarkMoves
 }
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 9d9304a..186f421 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -442,11 +442,14 @@
 // command alias, described below.
 //
 // To convey to humans and machine tools that code is generated,
-// generated source should have a line early in the file that
-// matches the following regular expression (in Go syntax):
+// generated source should have a line that matches the following
+// regular expression (in Go syntax):
 //
 // 	^// Code generated .* DO NOT EDIT\.$
 //
+// The line may appear anywhere in the file, but is typically
+// placed near the beginning so it is easy to find.
+//
 // Note that go generate does not parse the file, so lines that look
 // like directives in comments or multiline strings will be treated
 // as directives.
@@ -1397,7 +1400,6 @@
 // in the standard user cache directory for the current operating system.
 // Setting the GOCACHE environment variable overrides this default,
 // and running 'go env GOCACHE' prints the current cache directory.
-// You can set the variable to 'off' to disable the cache.
 //
 // The go command periodically deletes cached data that has not been
 // used recently. Running 'go clean -cache' deletes all cached data.
@@ -1596,14 +1598,14 @@
 // line comment. See the go/build package documentation for
 // more details.
 //
-// Non-test Go source files can also include a //go:binary-only-package
-// comment, indicating that the package sources are included
-// for documentation only and must not be used to build the
-// package binary. This enables distribution of Go packages in
-// their compiled form alone. Even binary-only packages require
-// accurate import blocks listing required dependencies, so that
-// those dependencies can be supplied when linking the resulting
-// command.
+// Through the Go 1.12 release, non-test Go source files can also include
+// a //go:binary-only-package comment, indicating that the package
+// sources are included for documentation only and must not be used to
+// build the package binary. This enables distribution of Go packages in
+// their compiled form alone. Even binary-only packages require accurate
+// import blocks listing required dependencies, so that those
+// dependencies can be supplied when linking the resulting command.
+// Note that this feature is scheduled to be removed after the Go 1.12 release.
 //
 //
 // The go.mod file
@@ -2494,7 +2496,8 @@
 // development module, then get will update the required version.
 // Specifying a version earlier than the current required version is valid and
 // downgrades the dependency. The version suffix @none indicates that the
-// dependency should be removed entirely.
+// dependency should be removed entirely, downgrading or removing modules
+// depending on it as needed.
 //
 // Although get defaults to using the latest version of the module containing
 // a named package, it does not use the latest version of that module's
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index e2ddc58..c58bc74 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -866,12 +866,54 @@
 
 func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
 	if testing.Short() {
-		t.Skip("don't rebuild the standard library in short mode")
+		t.Skip("skipping lengthy test in short mode")
 	}
 
 	tg := testgo(t)
 	defer tg.cleanup()
 
+	// Copy the runtime packages into a temporary GOROOT
+	// so that we can change files.
+	for _, copydir := range []string{
+		"src/runtime",
+		"src/internal/bytealg",
+		"src/internal/cpu",
+		"src/unsafe",
+		filepath.Join("pkg", runtime.GOOS+"_"+runtime.GOARCH),
+		filepath.Join("pkg/tool", runtime.GOOS+"_"+runtime.GOARCH),
+		"pkg/include",
+	} {
+		srcdir := filepath.Join(testGOROOT, copydir)
+		tg.tempDir(filepath.Join("goroot", copydir))
+		err := filepath.Walk(srcdir,
+			func(path string, info os.FileInfo, err error) error {
+				if err != nil {
+					return err
+				}
+				if info.IsDir() {
+					return nil
+				}
+				srcrel, err := filepath.Rel(srcdir, path)
+				if err != nil {
+					return err
+				}
+				dest := filepath.Join("goroot", copydir, srcrel)
+				data, err := ioutil.ReadFile(path)
+				if err != nil {
+					return err
+				}
+				tg.tempFile(dest, string(data))
+				if err := os.Chmod(tg.path(dest), info.Mode()); err != nil {
+					return err
+				}
+				return nil
+			})
+		if err != nil {
+			t.Fatal(err)
+		}
+	}
+	tg.setenv("GOROOT", tg.path("goroot"))
+
 	addVar := func(name string, idx int) (restore func()) {
 		data, err := ioutil.ReadFile(name)
 		if err != nil {
@@ -900,7 +942,7 @@
 	// Changing mtime of runtime/internal/sys/sys.go
 	// should have no effect: only the content matters.
 	// In fact this should be true even outside a release branch.
-	sys := runtime.GOROOT() + "/src/runtime/internal/sys/sys.go"
+	sys := tg.path("goroot/src/runtime/internal/sys/sys.go")
 	tg.sleep()
 	restore := addVar(sys, 0)
 	restore()
@@ -915,7 +957,7 @@
 	restore()
 	tg.wantNotStale("p1", "", "./testgo list claims p1 is stale, incorrectly, after changing back to old release")
 	addVar(sys, 2)
-	tg.wantStale("p1", "stale dependency: runtime/internal/sys", "./testgo list claims p1 is NOT stale, incorrectly, after changing sys.go again")
+	tg.wantStale("p1", "stale dependency: runtime", "./testgo list claims p1 is NOT stale, incorrectly, after changing sys.go again")
 	tg.run("install", "-i", "p1")
 	tg.wantNotStale("p1", "", "./testgo list claims p1 is stale after building with new release")
 
@@ -924,9 +966,6 @@
 	tg.wantStale("p1", "stale dependency: runtime/internal/sys", "./testgo list claims p1 is NOT stale, incorrectly, after restoring sys.go")
 	tg.run("install", "-i", "p1")
 	tg.wantNotStale("p1", "", "./testgo list claims p1 is stale after building with old release")
-
-	// Everything is out of date. Rebuild to leave things in a better state.
-	tg.run("install", "std")
 }
 
 func testLocalRun(tg *testgoData, exepath, local, match string) {
diff --git a/src/cmd/go/internal/cache/default.go b/src/cmd/go/internal/cache/default.go
index f545c14..7d389c3 100644
--- a/src/cmd/go/internal/cache/default.go
+++ b/src/cmd/go/internal/cache/default.go
@@ -37,7 +37,7 @@
 // the first time Default is called.
 func initDefaultCache() {
 	dir := DefaultDir()
-	if dir == "off" || dir == "" {
+	if dir == "off" {
 		if defaultDirErr != nil {
 			base.Fatalf("build cache is required, but could not be located: %v", defaultDirErr)
 		}
@@ -74,7 +74,12 @@
 
 	defaultDirOnce.Do(func() {
 		defaultDir = os.Getenv("GOCACHE")
+		if filepath.IsAbs(defaultDir) || defaultDir == "off" {
+			return
+		}
 		if defaultDir != "" {
+			defaultDir = "off"
+			defaultDirErr = fmt.Errorf("GOCACHE is not an absolute path")
 			return
 		}
 
diff --git a/src/cmd/go/internal/clean/clean.go b/src/cmd/go/internal/clean/clean.go
index 32cc807..27121ed 100644
--- a/src/cmd/go/internal/clean/clean.go
+++ b/src/cmd/go/internal/clean/clean.go
@@ -152,7 +152,9 @@
 				prev, _ := strconv.ParseInt(strings.TrimSpace(string(buf)), 10, 64)
 				if now > prev {
 					if err = f.Truncate(0); err == nil {
-						_, err = fmt.Fprintf(f, "%d\n", now)
+						if _, err = f.Seek(0, 0); err == nil {
+							_, err = fmt.Fprintf(f, "%d\n", now)
+						}
 					}
 				}
 				if closeErr := f.Close(); err == nil {
diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go
index 7cbc448..124dbc0 100644
--- a/src/cmd/go/internal/generate/generate.go
+++ b/src/cmd/go/internal/generate/generate.go
@@ -49,11 +49,14 @@
 command alias, described below.
 
 To convey to humans and machine tools that code is generated,
-generated source should have a line early in the file that
-matches the following regular expression (in Go syntax):
+generated source should have a line that matches the following
+regular expression (in Go syntax):
 
 	^// Code generated .* DO NOT EDIT\.$
 
+The line may appear anywhere in the file, but is typically
+placed near the beginning so it is easy to find.
+
 Note that go generate does not parse the file, so lines that look
 like directives in comments or multiline strings will be treated
 as directives.
diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go
index a7a2ba3..ce34d5a 100644
--- a/src/cmd/go/internal/get/vcs.go
+++ b/src/cmd/go/internal/get/vcs.go
@@ -424,8 +424,8 @@
 	cmd.Dir = dir
 	cmd.Env = base.EnvForDir(cmd.Dir, os.Environ())
 	if cfg.BuildX {
-		fmt.Printf("cd %s\n", dir)
-		fmt.Printf("%s %s\n", v.cmd, strings.Join(args, " "))
+		fmt.Fprintf(os.Stderr, "cd %s\n", dir)
+		fmt.Fprintf(os.Stderr, "%s %s\n", v.cmd, strings.Join(args, " "))
 	}
 	out, err := cmd.Output()
 	if err != nil {
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index 973bfbc..c219a45 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -636,14 +636,14 @@
 line comment. See the go/build package documentation for
 more details.
 
-Non-test Go source files can also include a //go:binary-only-package
-comment, indicating that the package sources are included
-for documentation only and must not be used to build the
-package binary. This enables distribution of Go packages in
-their compiled form alone. Even binary-only packages require
-accurate import blocks listing required dependencies, so that
-those dependencies can be supplied when linking the resulting
-command.
+Through the Go 1.12 release, non-test Go source files can also include
+a //go:binary-only-package comment, indicating that the package
+sources are included for documentation only and must not be used to
+build the package binary. This enables distribution of Go packages in
+their compiled form alone. Even binary-only packages require accurate
+import blocks listing required dependencies, so that those
+dependencies can be supplied when linking the resulting command.
+Note that this feature is scheduled to be removed after the Go 1.12 release.
 	`,
 }
 
@@ -705,7 +705,6 @@
 in the standard user cache directory for the current operating system.
 Setting the GOCACHE environment variable overrides this default,
 and running 'go env GOCACHE' prints the current cache directory.
-You can set the variable to 'off' to disable the cache.
 
 The go command periodically deletes cached data that has not been
 used recently. Running 'go clean -cache' deletes all cached data.
diff --git a/src/cmd/go/internal/imports/scan.go b/src/cmd/go/internal/imports/scan.go
index 966a38c..3d9b613 100644
--- a/src/cmd/go/internal/imports/scan.go
+++ b/src/cmd/go/internal/imports/scan.go
@@ -26,7 +26,7 @@
 		// If the directory entry is a symlink, stat it to obtain the info for the
 		// link target instead of the link itself.
 		if info.Mode()&os.ModeSymlink != 0 {
-			info, err = os.Stat(name)
+			info, err = os.Stat(filepath.Join(dir, name))
 			if err != nil {
 				continue // Ignore broken symlinks.
 			}
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index bfb36a6..3e056fe 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -1178,6 +1178,36 @@
 
 var foldPath = make(map[string]string)
 
+// DefaultExecName returns the default executable name
+// for a package with the import path importPath.
+//
+// The default executable name is the last element of the import path.
+// In module-aware mode, an additional rule is used. If the last element
+// is a vN path element specifying the major version, then the second last
+// element of the import path is used instead.
+func DefaultExecName(importPath string) string {
+	_, elem := pathpkg.Split(importPath)
+	if cfg.ModulesEnabled {
+		// If this is example.com/mycmd/v2, it's more useful to install it as mycmd than as v2.
+		// See golang.org/issue/24667.
+		isVersion := func(v string) bool {
+			if len(v) < 2 || v[0] != 'v' || v[1] < '1' || '9' < v[1] {
+				return false
+			}
+			for i := 2; i < len(v); i++ {
+				if c := v[i]; c < '0' || '9' < c {
+					return false
+				}
+			}
+			return true
+		}
+		if isVersion(elem) {
+			_, elem = pathpkg.Split(pathpkg.Dir(importPath))
+		}
+	}
+	return elem
+}
+
 // load populates p using information from bp, err, which should
 // be the result of calling build.Context.Import.
 func (p *Package) load(stk *ImportStack, bp *build.Package, err error) {
@@ -1220,7 +1250,7 @@
 		}
 		_, elem := filepath.Split(p.Dir)
 		if cfg.ModulesEnabled {
-			// NOTE(rsc): Using p.ImportPath instead of p.Dir
+			// NOTE(rsc,dmitshur): Using p.ImportPath instead of p.Dir
 			// makes sure we install a package in the root of a
 			// cached module directory as that package name
 			// not name@v1.2.3.
@@ -1229,26 +1259,9 @@
 			// even for non-module-enabled code,
 			// but I'm not brave enough to change the
 			// non-module behavior this late in the
-			// release cycle. Maybe for Go 1.12.
+			// release cycle. Can be done for Go 1.13.
 			// See golang.org/issue/26869.
-			_, elem = pathpkg.Split(p.ImportPath)
-
-			// If this is example.com/mycmd/v2, it's more useful to install it as mycmd than as v2.
-			// See golang.org/issue/24667.
-			isVersion := func(v string) bool {
-				if len(v) < 2 || v[0] != 'v' || v[1] < '1' || '9' < v[1] {
-					return false
-				}
-				for i := 2; i < len(v); i++ {
-					if c := v[i]; c < '0' || '9' < c {
-						return false
-					}
-				}
-				return true
-			}
-			if isVersion(elem) {
-				_, elem = pathpkg.Split(pathpkg.Dir(p.ImportPath))
-			}
+			elem = DefaultExecName(p.ImportPath)
 		}
 		full := cfg.BuildContext.GOOS + "_" + cfg.BuildContext.GOARCH + "/" + elem
 		if cfg.BuildContext.GOOS != base.ToolGOOS || cfg.BuildContext.GOARCH != base.ToolGOARCH {
diff --git a/src/cmd/go/internal/load/test.go b/src/cmd/go/internal/load/test.go
index bd6f00b..48d03d8 100644
--- a/src/cmd/go/internal/load/test.go
+++ b/src/cmd/go/internal/load/test.go
@@ -129,6 +129,7 @@
 		ptest.Internal.Imports = append(imports, p.Internal.Imports...)
 		ptest.Internal.RawImports = str.StringList(rawTestImports, p.Internal.RawImports)
 		ptest.Internal.ForceLibrary = true
+		ptest.Internal.BuildInfo = ""
 		ptest.Internal.Build = new(build.Package)
 		*ptest.Internal.Build = *p.Internal.Build
 		m := map[string][]token.Position{}
@@ -186,6 +187,7 @@
 		},
 		Internal: PackageInternal{
 			Build:      &build.Package{Name: "main"},
+			BuildInfo:  p.Internal.BuildInfo,
 			Asmflags:   p.Internal.Asmflags,
 			Gcflags:    p.Internal.Gcflags,
 			Ldflags:    p.Internal.Ldflags,
@@ -266,17 +268,8 @@
 	pmain.Imports = pmain.Imports[:w]
 	pmain.Internal.RawImports = str.StringList(pmain.Imports)
 
-	if ptest != p {
-		// We have made modifications to the package p being tested
-		// and are rebuilding p (as ptest).
-		// Arrange to rebuild all packages q such that
-		// the test depends on q and q depends on p.
-		// This makes sure that q sees the modifications to p.
-		// Strictly speaking, the rebuild is only necessary if the
-		// modifications to p change its export metadata, but
-		// determining that is a bit tricky, so we rebuild always.
-		recompileForTest(pmain, p, ptest, pxtest)
-	}
+	// Replace pmain's transitive dependencies with test copies, as necessary.
+	recompileForTest(pmain, p, ptest, pxtest)
 
 	// Should we apply coverage analysis locally,
 	// only for this package and only for this test?
@@ -323,6 +316,14 @@
 	return stk
 }
 
+// recompileForTest copies and replaces certain packages in pmain's dependency
+// graph. This is necessary for two reasons. First, if ptest is different than
+// preal, packages that import the package under test should get ptest instead
+// of preal. This is particularly important if pxtest depends on functionality
+// exposed in test sources in ptest. Second, if there is a main package
+// (other than pmain) anywhere, we need to clear p.Internal.BuildInfo in
+// the test copy to prevent link conflicts. This may happen if both -coverpkg
+// and the command line patterns include multiple main packages.
 func recompileForTest(pmain, preal, ptest, pxtest *Package) {
 	// The "test copy" of preal is ptest.
 	// For each package that depends on preal, make a "test copy"
@@ -352,6 +353,7 @@
 			copy(p1.Imports, p.Imports)
 			p = p1
 			p.Target = ""
+			p.Internal.BuildInfo = ""
 		}
 
 		// Update p.Internal.Imports to use test copies.
@@ -361,6 +363,13 @@
 				p.Internal.Imports[i] = p1
 			}
 		}
+
+		// Don't compile build info from a main package. This can happen
+		// if -coverpkg patterns include main packages, since those packages
+		// are imported by pmain. See golang.org/issue/30907.
+		if p.Internal.BuildInfo != "" && p != pmain {
+			split()
+		}
 	}
 }
 
diff --git a/src/cmd/go/internal/modcmd/tidy.go b/src/cmd/go/internal/modcmd/tidy.go
index 839c92a..789e936 100644
--- a/src/cmd/go/internal/modcmd/tidy.go
+++ b/src/cmd/go/internal/modcmd/tidy.go
@@ -75,6 +75,7 @@
 	// we only have to tell modfetch what needs keeping.
 	reqs := modload.Reqs()
 	keep := make(map[module.Version]bool)
+	replaced := make(map[module.Version]bool)
 	var walk func(module.Version)
 	walk = func(m module.Version) {
 		// If we build using a replacement module, keep the sum for the replacement,
@@ -87,10 +88,11 @@
 			keep[m] = true
 		} else {
 			keep[r] = true
+			replaced[m] = true
 		}
 		list, _ := reqs.Required(m)
 		for _, r := range list {
-			if !keep[r] {
+			if !keep[r] && !replaced[r] {
 				walk(r)
 			}
 		}
diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go
index 5018b6d..da9f63f 100644
--- a/src/cmd/go/internal/modfetch/coderepo.go
+++ b/src/cmd/go/internal/modfetch/coderepo.go
@@ -23,55 +23,99 @@
 type codeRepo struct {
 	modPath string
 
-	code     codehost.Repo
+	// code is the repository containing this module.
+	code codehost.Repo
+	// codeRoot is the import path at the root of code.
 	codeRoot string
-	codeDir  string
+	// codeDir is the directory (relative to root) at which we expect to find the module.
+	// If pathMajor is non-empty and codeRoot is not the full modPath,
+	// then we look in both codeDir and codeDir+modPath
+	codeDir string
 
-	path        string
-	pathPrefix  string
-	pathMajor   string
+	// pathMajor is the suffix of modPath that indicates its major version,
+	// or the empty string if modPath is at major version 0 or 1.
+	//
+	// pathMajor is typically of the form "/vN", but possibly ".vN", or
+	// ".vN-unstable" for modules resolved using gopkg.in.
+	pathMajor string
+	// pathPrefix is the prefix of modPath that excludes pathMajor.
+	// It is used only for logging.
+	pathPrefix string
+
+	// pseudoMajor is the major version prefix to use when generating
+	// pseudo-versions for this module, derived from the module path.
+	//
+	// TODO(golang.org/issue/29262): We can't distinguish v0 from v1 using the
+	// path alone: we have to compute it by examining the tags at a particular
+	// revision.
 	pseudoMajor string
 }
 
-func newCodeRepo(code codehost.Repo, root, path string) (Repo, error) {
-	if !hasPathPrefix(path, root) {
-		return nil, fmt.Errorf("mismatched repo: found %s for %s", root, path)
+// newCodeRepo returns a Repo that reads the source code for the module with the
+// given path, from the repo stored in code, with the root of the repo
+// containing the path given by codeRoot.
+func newCodeRepo(code codehost.Repo, codeRoot, path string) (Repo, error) {
+	if !hasPathPrefix(path, codeRoot) {
+		return nil, fmt.Errorf("mismatched repo: found %s for %s", codeRoot, path)
 	}
 	pathPrefix, pathMajor, ok := module.SplitPathVersion(path)
 	if !ok {
 		return nil, fmt.Errorf("invalid module path %q", path)
 	}
+	if codeRoot == path {
+		pathPrefix = path
+	}
 	pseudoMajor := "v0"
 	if pathMajor != "" {
 		pseudoMajor = pathMajor[1:]
 	}
 
+	// Compute codeDir = bar, the subdirectory within the repo
+	// corresponding to the module root.
+	//
 	// At this point we might have:
-	//	codeRoot = github.com/rsc/foo
 	//	path = github.com/rsc/foo/bar/v2
+	//	codeRoot = github.com/rsc/foo
 	//	pathPrefix = github.com/rsc/foo/bar
 	//	pathMajor = /v2
 	//	pseudoMajor = v2
 	//
-	// Compute codeDir = bar, the subdirectory within the repo
-	// corresponding to the module root.
-	codeDir := strings.Trim(strings.TrimPrefix(pathPrefix, root), "/")
-	if strings.HasPrefix(path, "gopkg.in/") {
-		// But gopkg.in is a special legacy case, in which pathPrefix does not start with codeRoot.
-		// For example we might have:
-		//	codeRoot = gopkg.in/yaml.v2
-		//	pathPrefix = gopkg.in/yaml
-		//	pathMajor = .v2
-		//	pseudoMajor = v2
-		//	codeDir = pathPrefix (because codeRoot is not a prefix of pathPrefix)
-		// Clear codeDir - the module root is the repo root for gopkg.in repos.
-		codeDir = ""
+	// which gives
+	//	codeDir = bar
+	//
+	// We know that pathPrefix is a prefix of path, and codeRoot is a prefix of
+	// path, but codeRoot may or may not be a prefix of pathPrefix, because
+	// codeRoot may be the entire path (in which case codeDir should be empty).
+	// That occurs in two situations.
+	//
+	// One is when a go-import meta tag resolves the complete module path,
+	// including the pathMajor suffix:
+	//	path = nanomsg.org/go/mangos/v2
+	//	codeRoot = nanomsg.org/go/mangos/v2
+	//	pathPrefix = nanomsg.org/go/mangos
+	//	pathMajor = /v2
+	//	pseudoMajor = v2
+	//
+	// The other is similar: for gopkg.in only, the major version is encoded
+	// with a dot rather than a slash, and thus can't be in a subdirectory.
+	//	path = gopkg.in/yaml.v2
+	//	codeRoot = gopkg.in/yaml.v2
+	//	pathPrefix = gopkg.in/yaml
+	//	pathMajor = .v2
+	//	pseudoMajor = v2
+	//
+	codeDir := ""
+	if codeRoot != path {
+		if !hasPathPrefix(pathPrefix, codeRoot) {
+			return nil, fmt.Errorf("repository rooted at %s cannot contain module %s", codeRoot, path)
+		}
+		codeDir = strings.Trim(pathPrefix[len(codeRoot):], "/")
 	}
 
 	r := &codeRepo{
 		modPath:     path,
 		code:        code,
-		codeRoot:    root,
+		codeRoot:    codeRoot,
 		codeDir:     codeDir,
 		pathPrefix:  pathPrefix,
 		pathMajor:   pathMajor,
@@ -149,9 +193,6 @@
 		return r.Latest()
 	}
 	codeRev := r.revToRev(rev)
-	if semver.IsValid(codeRev) && r.codeDir != "" {
-		codeRev = r.codeDir + "/" + codeRev
-	}
 	info, err := r.code.Stat(codeRev)
 	if err != nil {
 		return nil, err
@@ -290,7 +331,7 @@
 	found1 := err1 == nil && isMajor(mpath1, r.pathMajor)
 
 	var file2 string
-	if r.pathMajor != "" && !strings.HasPrefix(r.pathMajor, ".") {
+	if r.pathMajor != "" && r.codeRoot != r.modPath && !strings.HasPrefix(r.pathMajor, ".") {
 		// Suppose pathMajor is "/v2".
 		// Either go.mod should claim v2 and v2/go.mod should not exist,
 		// or v2/go.mod should exist and claim v2. Not both.
@@ -298,6 +339,9 @@
 		// because of replacement modules. This might be a fork of
 		// the real module, found at a different path, usable only in
 		// a replace directive.
+		//
+		// TODO(bcmills): This doesn't seem right. Investigate futher.
+		// (Notably: why can't we replace foo/v2 with fork-of-foo/v3?)
 		dir2 := path.Join(r.codeDir, r.pathMajor[1:])
 		file2 = path.Join(dir2, "go.mod")
 		gomod2, err2 := r.code.ReadFile(rev, file2, codehost.MaxGoMod)
@@ -418,7 +462,7 @@
 	}
 	defer dl.Close()
 	if actualDir != "" && !hasPathPrefix(dir, actualDir) {
-		return fmt.Errorf("internal error: downloading %v %v: dir=%q but actualDir=%q", r.path, rev, dir, actualDir)
+		return fmt.Errorf("internal error: downloading %v %v: dir=%q but actualDir=%q", r.modPath, rev, dir, actualDir)
 	}
 	subdir := strings.Trim(strings.TrimPrefix(dir, actualDir), "/")
 
diff --git a/src/cmd/go/internal/modfetch/coderepo_test.go b/src/cmd/go/internal/modfetch/coderepo_test.go
index c93d8db..7a41957 100644
--- a/src/cmd/go/internal/modfetch/coderepo_test.go
+++ b/src/cmd/go/internal/modfetch/coderepo_test.go
@@ -323,6 +323,15 @@
 		time:    time.Date(2017, 5, 31, 16, 3, 50, 0, time.UTC),
 		gomod:   "module gopkg.in/natefinch/lumberjack.v2\n",
 	},
+	{
+		path:    "nanomsg.org/go/mangos/v2",
+		rev:     "v2.0.2",
+		version: "v2.0.2",
+		name:    "63f66a65137b9a648ac9f7bf0160b4a4d17d7999",
+		short:   "63f66a65137b",
+		time:    time.Date(2018, 12, 1, 15, 7, 40, 0, time.UTC),
+		gomod:   "module nanomsg.org/go/mangos/v2\n\nrequire (\n\tgithub.com/Microsoft/go-winio v0.4.11\n\tgithub.com/droundy/goopt v0.0.0-20170604162106-0b8effe182da\n\tgithub.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect\n\tgithub.com/gorilla/websocket v1.4.0\n\tgithub.com/jtolds/gls v4.2.1+incompatible // indirect\n\tgithub.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect\n\tgithub.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c\n\tgolang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 // indirect\n)\n",
+	},
 }
 
 func TestCodeRepo(t *testing.T) {
diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go
index 2bfe6d3..17a0ed4 100644
--- a/src/cmd/go/internal/modget/get.go
+++ b/src/cmd/go/internal/modget/get.go
@@ -56,7 +56,8 @@
 development module, then get will update the required version.
 Specifying a version earlier than the current required version is valid and
 downgrades the dependency. The version suffix @none indicates that the
-dependency should be removed entirely.
+dependency should be removed entirely, downgrading or removing modules
+depending on it as needed.
 
 Although get defaults to using the latest version of the module containing
 a named package, it does not use the latest version of that module's
diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go
index efeb7a5..2a8be90 100644
--- a/src/cmd/go/internal/modload/build.go
+++ b/src/cmd/go/internal/modload/build.go
@@ -252,13 +252,19 @@
 func ModInfoProg(info string) []byte {
 	// Inject a variable with the debug information as runtime/debug.modinfo,
 	// but compile it in package main so that it is specific to the binary.
-	// Populate it in an init func so that it will work with go:linkname,
-	// but use a string constant instead of the name 'string' in case
-	// package main shadows the built-in 'string' with some local declaration.
+	//
+	// The variable must be a literal so that it will have the correct value
+	// before the initializer for package main runs.
+	//
+	// We also want the value to be present even if runtime/debug.modinfo is
+	// otherwise unused in the rest of the program. Reading it in an init function
+	// suffices for now.
+
 	return []byte(fmt.Sprintf(`package main
 import _ "unsafe"
 //go:linkname __debug_modinfo__ runtime/debug.modinfo
-var __debug_modinfo__ = ""
-func init() { __debug_modinfo__ = %q }
+var __debug_modinfo__ = %q
+var keepalive_modinfo = __debug_modinfo__
+func init() { keepalive_modinfo = __debug_modinfo__ }
 	`, string(infoStart)+info+string(infoEnd)))
 }
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index 8dfb3df..52b1511 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -805,7 +805,7 @@
 	if p.ImportPath == "command-line-arguments" {
 		elem = p.Name
 	} else {
-		_, elem = path.Split(p.ImportPath)
+		elem = load.DefaultExecName(p.ImportPath)
 	}
 	testBinary := elem + ".test"
 
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
index 145b875..ed66df2 100644
--- a/src/cmd/go/internal/work/build.go
+++ b/src/cmd/go/internal/work/build.go
@@ -10,7 +10,6 @@
 	"go/build"
 	"os"
 	"os/exec"
-	"path"
 	"path/filepath"
 	"runtime"
 	"strings"
@@ -285,7 +284,7 @@
 	pkgs := load.PackagesForBuild(args)
 
 	if len(pkgs) == 1 && pkgs[0].Name == "main" && cfg.BuildO == "" {
-		_, cfg.BuildO = path.Split(pkgs[0].ImportPath)
+		cfg.BuildO = load.DefaultExecName(pkgs[0].ImportPath)
 		cfg.BuildO += cfg.ExeSuffix
 	}
 
@@ -518,7 +517,7 @@
 	if len(patterns) == 0 && len(pkgs) == 1 && pkgs[0].Name == "main" {
 		// Compute file 'go build' would have created.
 		// If it exists and is an executable file, remove it.
-		_, targ := filepath.Split(pkgs[0].ImportPath)
+		targ := load.DefaultExecName(pkgs[0].ImportPath)
 		targ += cfg.ExeSuffix
 		if filepath.Join(pkgs[0].Dir, targ) != pkgs[0].Target { // maybe $GOBIN is the current directory
 			fi, err := os.Stat(targ)
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
index b8e560a..af9565b 100644
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
@@ -214,6 +214,7 @@
 	if p.Internal.CoverMode != "" {
 		fmt.Fprintf(h, "cover %q %q\n", p.Internal.CoverMode, b.toolID("cover"))
 	}
+	fmt.Fprintf(h, "modinfo %q\n", p.Internal.BuildInfo)
 
 	// Configuration specific to compiler toolchain.
 	switch cfg.BuildToolchainName {
@@ -655,7 +656,7 @@
 	if len(out) > 0 {
 		output := b.processOutput(out)
 		if p.Module != nil && !allowedVersion(p.Module.GoVersion) {
-			output += "note: module requires Go " + p.Module.GoVersion
+			output += "note: module requires Go " + p.Module.GoVersion + "\n"
 		}
 		b.showOutput(a, a.Package.Dir, a.Package.Desc(), output)
 		if err != nil {
diff --git a/src/cmd/go/testdata/mod/rsc.io_fortune_v2_v2.0.0.txt b/src/cmd/go/testdata/mod/rsc.io_fortune_v2_v2.0.0.txt
index cfa91f0..3acd637 100644
--- a/src/cmd/go/testdata/mod/rsc.io_fortune_v2_v2.0.0.txt
+++ b/src/cmd/go/testdata/mod/rsc.io_fortune_v2_v2.0.0.txt
@@ -13,3 +13,9 @@
 func main() {
 	println(quote.Hello())
 }
+-- fortune_test.go --
+package main
+
+import "testing"
+
+func TestFortuneV2(t *testing.T) {}
diff --git a/src/cmd/go/testdata/script/build_nocache.txt b/src/cmd/go/testdata/script/build_nocache.txt
index 5aa46e0..d1b12f4 100644
--- a/src/cmd/go/testdata/script/build_nocache.txt
+++ b/src/cmd/go/testdata/script/build_nocache.txt
@@ -10,6 +10,11 @@
 ! go build -o triv triv.go
 stderr 'build cache is required, but could not be located: GOCACHE is not defined and .*'
 
+# If GOCACHE is set but is not an absolute path, and we cannot build.
+env GOCACHE=test
+! go build -o triv triv.go
+stderr 'build cache is required, but could not be located: GOCACHE is not an absolute path'
+
 # An explicit GOCACHE=off also disables builds.
 env GOCACHE=off
 ! go build -o triv triv.go
diff --git a/src/cmd/go/testdata/script/clean_testcache.txt b/src/cmd/go/testdata/script/clean_testcache.txt
new file mode 100644
index 0000000..a2d592d
--- /dev/null
+++ b/src/cmd/go/testdata/script/clean_testcache.txt
@@ -0,0 +1,16 @@
+# go clean -testcache
+# should work (see golang.org/issue/29757).
+cd x
+go test x_test.go
+go clean -testcache
+go test x_test.go
+! stdout 'cached'
+
+
+-- x/x_test.go --
+package x_test
+import (
+    "testing"
+)
+func TestMain(t *testing.T) {
+}
\ No newline at end of file
diff --git a/src/cmd/go/testdata/script/cover_pkgall_multiple_mains.txt b/src/cmd/go/testdata/script/cover_pkgall_multiple_mains.txt
new file mode 100644
index 0000000..ab7cd66
--- /dev/null
+++ b/src/cmd/go/testdata/script/cover_pkgall_multiple_mains.txt
@@ -0,0 +1,43 @@
+# This test checks that multiple main packages can be tested
+# with -coverpkg=all without duplicate symbol errors.
+# Verifies golang.org/issue/30374.
+
+env GO111MODULE=on
+
+[short] skip
+
+go test -coverpkg=all ./...
+
+-- go.mod --
+module example.com/cov
+
+-- mainonly/mainonly.go --
+package main
+
+func main() {}
+
+-- mainwithtest/mainwithtest.go --
+package main
+
+func main() {}
+
+func Foo() {}
+
+-- mainwithtest/mainwithtest_test.go --
+package main
+
+import "testing"
+
+func TestFoo(t *testing.T) {
+  Foo()
+}
+
+-- xtest/x.go --
+package x
+
+-- xtest/x_test.go --
+package x_test
+
+import "testing"
+
+func TestX(t *testing.T) {}
diff --git a/src/cmd/go/testdata/script/mod_build_versioned.txt b/src/cmd/go/testdata/script/mod_build_versioned.txt
new file mode 100644
index 0000000..eb081c9
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_build_versioned.txt
@@ -0,0 +1,16 @@
+env GO111MODULE=on
+
+go get -m rsc.io/fortune/v2
+
+# The default executable name shouldn't be v2$exe
+go build rsc.io/fortune/v2
+! exists v2$exe
+exists fortune$exe
+
+# The default test binary name shouldn't be v2.test$exe
+go test -c rsc.io/fortune/v2
+! exists v2.test$exe
+exists fortune.test$exe
+
+-- go.mod --
+module scratch
diff --git a/src/cmd/go/testdata/script/mod_modinfo.txt b/src/cmd/go/testdata/script/mod_modinfo.txt
index f8ad18f..fb31f9e 100644
--- a/src/cmd/go/testdata/script/mod_modinfo.txt
+++ b/src/cmd/go/testdata/script/mod_modinfo.txt
@@ -7,34 +7,83 @@
 go mod edit -require=rsc.io/quote@v1.5.2
 go mod edit -replace=rsc.io/quote@v1.5.2=rsc.io/quote@v1.0.0
 
-go run main.go
-
-stderr 'Hello, world.'
+# Build a binary and ensure that it can output its own debug info.
+# The debug info should be accessible before main starts (golang.org/issue/29628).
+go build
+exec ./x$GOEXE
 stderr 'mod\s+x\s+\(devel\)'
 stderr 'dep\s+rsc.io/quote\s+v1.5.2\s+'
 stderr '=>\s+rsc.io/quote\s+v1.0.0\s+h1:'
+stderr 'Hello, world.'
+
+[short] skip
+
+# Build a binary that accesses its debug info by reading the binary directly
+# (rather than through debug.ReadBuildInfo).
+# The debug info should still be present (golang.org/issue/28753).
+cd unused
+go build
+exec ./unused$GOEXE
 
 -- x/go.mod --
 module x
 
+-- x/lib/lib.go --
+// Package lib accesses runtime/debug.modinfo before package main's init
+// functions have run.
+package lib
+
+import "runtime/debug"
+
+func init() {
+	m, ok := debug.ReadBuildInfo()
+	if !ok {
+		panic("failed debug.ReadBuildInfo")
+	}
+	println("mod", m.Main.Path, m.Main.Version)
+	for _, d := range m.Deps {
+		println("dep", d.Path, d.Version, d.Sum)
+		if r := d.Replace; r != nil {
+			println("=>", r.Path, r.Version, r.Sum)
+		}
+	}
+}
+
 -- x/main.go --
 package main
 
-import "runtime/debug"
-import "rsc.io/quote"
+import (
+	"rsc.io/quote"
+	_ "x/lib"
+)
 
 func main() {
-  println(quote.Hello())
+	println(quote.Hello())
+}
 
-  m, ok := debug.ReadBuildInfo()
-  if !ok {
-     panic("failed debug.ReadBuildInfo")
-  }
-  println("mod", m.Main.Path, m.Main.Version)
-  for _, d := range m.Deps {
-     println("dep", d.Path, d.Version, d.Sum)
-     if r := d.Replace; r != nil {
-        println("=>", r.Path, r.Version, r.Sum)
-     }
-  }
+-- x/unused/main.go --
+// The unused binary does not access runtime/debug.modinfo.
+package main
+
+import (
+	"bytes"
+	"encoding/hex"
+	"io/ioutil"
+	"log"
+	"os"
+
+	_ "rsc.io/quote"
+)
+
+func main() {
+	b, err := ioutil.ReadFile(os.Args[0])
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	infoStart, _ := hex.DecodeString("3077af0c9274080241e1c107e6d618e6")
+	if !bytes.Contains(b, infoStart) {
+		log.Fatal("infoStart not found in binary")
+	}
+	log.Println("ok")
 }
diff --git a/src/cmd/go/testdata/script/mod_symlink.txt b/src/cmd/go/testdata/script/mod_symlink.txt
index 61da3cc..49bece2 100644
--- a/src/cmd/go/testdata/script/mod_symlink.txt
+++ b/src/cmd/go/testdata/script/mod_symlink.txt
@@ -2,16 +2,31 @@
 [!symlink] skip
 
 # 'go list' should resolve modules of imported packages.
-go list -deps -f '{{.Module}}'
+go list -deps -f '{{.Module}}' .
 stdout golang.org/x/text
 
-# They should continue to resolve if the importing file is a symlink.
-mkdir links
-cd links
-symlink go.mod -> ../go.mod
-symlink issue.go -> ../issue.go
+go list -deps -f '{{.Module}}' ./subpkg
+stdout golang.org/x/text
 
-go list -deps -f '{{.Module}}'
+# Create a copy of the module using symlinks in src/links.
+mkdir links
+symlink links/go.mod -> $GOPATH/src/go.mod
+symlink links/issue.go -> $GOPATH/src/issue.go
+mkdir links/subpkg
+symlink links/subpkg/issue.go -> $GOPATH/src/subpkg/issue.go
+
+# We should see the copy as a valid module root.
+cd links
+go env GOMOD
+stdout links[/\\]go.mod
+go list -m
+stdout golang.org/issue/28107
+
+# The symlink-based copy should contain the same packages
+# and have the same dependencies as the original.
+go list -deps -f '{{.Module}}' .
+stdout golang.org/x/text
+go list -deps -f '{{.Module}}' ./subpkg
 stdout golang.org/x/text
 
 -- go.mod --
@@ -21,3 +36,7 @@
 package issue
 
 import _ "golang.org/x/text/language"
+-- subpkg/issue.go --
+package issue
+
+import _ "golang.org/x/text/language"
diff --git a/src/cmd/go/testdata/script/mod_tidy_replace.txt b/src/cmd/go/testdata/script/mod_tidy_replace.txt
index 70c789a..86467a6 100644
--- a/src/cmd/go/testdata/script/mod_tidy_replace.txt
+++ b/src/cmd/go/testdata/script/mod_tidy_replace.txt
@@ -1,5 +1,12 @@
 env GO111MODULE=on
 
+# golang.org/issue/30166: 'go mod tidy' should not crash if a replaced module is
+# involved in a cycle.
+cd cycle
+env GOTRACEBACK=off
+go mod tidy
+cd ..
+
 # From inside the module, 'go list -m all' should NOT include transitive
 # requirements of modules that have been replaced.
 go list -m all
@@ -69,3 +76,35 @@
 	_ "rsc.io/sampler"
 	_ "golang.org/x/text/language"
 )
+
+-- cycle/go.mod --
+module golang.org/issue/30166
+
+require (
+	golang.org/issue/30166/a v0.0.0
+	golang.org/issue/30166/b v0.0.0
+)
+
+replace (
+	golang.org/issue/30166/a => ./a
+	golang.org/issue/30166/b => ./b
+)
+-- cycle/cycle.go --
+package cycle
+
+import (
+	_ "golang.org/issue/30166/a"
+	_ "golang.org/issue/30166/b"
+)
+-- cycle/a/a.go --
+package a
+-- cycle/a/go.mod --
+module golang.org/issue/30166/a
+
+require golang.org/issue/30166/b v0.0.0
+-- cycle/b/b.go --
+package b
+-- cycle/b/go.mod --
+module golang.org/issue/30166/b
+
+require golang.org/issue/30166/a v0.0.0
diff --git a/src/cmd/internal/obj/arm/asm5.go b/src/cmd/internal/obj/arm/asm5.go
index 316937b..b1fb1d3 100644
--- a/src/cmd/internal/obj/arm/asm5.go
+++ b/src/cmd/internal/obj/arm/asm5.go
@@ -1529,8 +1529,7 @@
 		return
 	}
 
-	deferreturn = ctxt.Lookup("runtime.deferreturn")
-	deferreturn.SetABI(obj.ABIInternal)
+	deferreturn = ctxt.LookupABI("runtime.deferreturn", obj.ABIInternal)
 
 	symdiv = ctxt.Lookup("runtime._div")
 	symdivu = ctxt.Lookup("runtime._divu")
diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go
index 093b222..cbe5796 100644
--- a/src/cmd/internal/obj/arm64/asm7.go
+++ b/src/cmd/internal/obj/arm64/asm7.go
@@ -2986,7 +2986,7 @@
 		num := uint8(0)
 		cls := oclass(&p.From)
 		if isADDWop(p.As) {
-			if (cls != C_LCON) && (cls != C_ADDCON2) {
+			if !cmp(C_LCON, cls) {
 				c.ctxt.Diag("illegal combination: %v", p)
 			}
 			num = c.omovlconst(AMOVW, p, &p.From, REGTMP, os[:])
@@ -3271,7 +3271,7 @@
 		num := uint8(0)
 		cls := oclass(&p.From)
 		if isANDWop(p.As) {
-			if (cls != C_LCON) && (cls != C_ADDCON) {
+			if !cmp(C_LCON, cls) {
 				c.ctxt.Diag("illegal combination: %v", p)
 			}
 			num = c.omovlconst(AMOVW, p, &p.From, REGTMP, os[:])
diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go
index 7df8e2e..f506f60 100644
--- a/src/cmd/internal/obj/link.go
+++ b/src/cmd/internal/obj/link.go
@@ -626,8 +626,9 @@
 	Flag_locationlists bool
 	Bso                *bufio.Writer
 	Pathname           string
-	hashmu             sync.Mutex       // protects hash
+	hashmu             sync.Mutex       // protects hash, funchash
 	hash               map[string]*LSym // name -> sym mapping
+	funchash           map[string]*LSym // name -> sym mapping for ABIInternal syms
 	statichash         map[string]*LSym // name -> sym mapping for static syms
 	PosTable           src.PosTable
 	InlTree            InlTree // global inlining tree used by gc/inl.go
diff --git a/src/cmd/internal/obj/sym.go b/src/cmd/internal/obj/sym.go
index 3fc17fa..15a501c 100644
--- a/src/cmd/internal/obj/sym.go
+++ b/src/cmd/internal/obj/sym.go
@@ -41,6 +41,7 @@
 func Linknew(arch *LinkArch) *Link {
 	ctxt := new(Link)
 	ctxt.hash = make(map[string]*LSym)
+	ctxt.funchash = make(map[string]*LSym)
 	ctxt.statichash = make(map[string]*LSym)
 	ctxt.Arch = arch
 	ctxt.Pathname = objabi.WorkingDir()
@@ -74,6 +75,30 @@
 	return s
 }
 
+// LookupABI looks up a symbol with the given ABI.
+// If it does not exist, it creates it.
+func (ctxt *Link) LookupABI(name string, abi ABI) *LSym {
+	var hash map[string]*LSym
+	switch abi {
+	case ABI0:
+		hash = ctxt.hash
+	case ABIInternal:
+		hash = ctxt.funchash
+	default:
+		panic("unknown ABI")
+	}
+
+	ctxt.hashmu.Lock()
+	s := hash[name]
+	if s == nil {
+		s = &LSym{Name: name}
+		s.SetABI(abi)
+		hash[name] = s
+	}
+	ctxt.hashmu.Unlock()
+	return s
+}
+
 // Lookup looks up the symbol with name name.
 // If it does not exist, it creates it.
 func (ctxt *Link) Lookup(name string) *LSym {
diff --git a/src/cmd/internal/obj/wasm/wasmobj.go b/src/cmd/internal/obj/wasm/wasmobj.go
index 23283a1..fbea103 100644
--- a/src/cmd/internal/obj/wasm/wasmobj.go
+++ b/src/cmd/internal/obj/wasm/wasmobj.go
@@ -125,11 +125,13 @@
 	morestack = ctxt.Lookup("runtime.morestack")
 	morestackNoCtxt = ctxt.Lookup("runtime.morestack_noctxt")
 	gcWriteBarrier = ctxt.Lookup("runtime.gcWriteBarrier")
-	sigpanic = ctxt.Lookup("runtime.sigpanic")
-	sigpanic.SetABI(obj.ABIInternal)
-	deferreturn = ctxt.Lookup("runtime.deferreturn")
-	deferreturn.SetABI(obj.ABIInternal)
-	jmpdefer = ctxt.Lookup(`"".jmpdefer`)
+	sigpanic = ctxt.LookupABI("runtime.sigpanic", obj.ABIInternal)
+	deferreturn = ctxt.LookupABI("runtime.deferreturn", obj.ABIInternal)
+	// jmpdefer is defined in assembly as ABI0, but what we're
+	// looking for is the *call* to jmpdefer from the Go function
+	// deferreturn, so we're looking for the ABIInternal version
+	// of jmpdefer that's called by Go.
+	jmpdefer = ctxt.LookupABI(`"".jmpdefer`, obj.ABIInternal)
 }
 
 func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go
index e4aa0e7..398dc47 100644
--- a/src/cmd/internal/obj/x86/asm6.go
+++ b/src/cmd/internal/obj/x86/asm6.go
@@ -2064,8 +2064,7 @@
 	case objabi.Hplan9:
 		plan9privates = ctxt.Lookup("_privates")
 	case objabi.Hnacl:
-		deferreturn = ctxt.Lookup("runtime.deferreturn")
-		deferreturn.SetABI(obj.ABIInternal)
+		deferreturn = ctxt.LookupABI("runtime.deferreturn", obj.ABIInternal)
 	}
 
 	for i := range avxOptab {
diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go
index 1792df7..a30bc3f 100644
--- a/src/cmd/internal/objabi/funcid.go
+++ b/src/cmd/internal/objabi/funcid.go
@@ -83,7 +83,7 @@
 	case "runtime.panicwrap":
 		return FuncID_panicwrap
 	}
-	if file == "<autogenerated>" && !strings.HasSuffix(name, ".init") {
+	if file == "<autogenerated>" {
 		return FuncID_wrapper
 	}
 	if strings.HasPrefix(name, "runtime.call") {
diff --git a/src/cmd/link/doc.go b/src/cmd/link/doc.go
index 963d86a..219499b 100644
--- a/src/cmd/link/doc.go
+++ b/src/cmd/link/doc.go
@@ -43,8 +43,16 @@
 		or initialized to a constant string expression. -X will not work if the initializer makes
 		a function call or refers to other variables.
 		Note that before Go 1.5 this option took two separate arguments.
+	-a
+		Disassemble output.
+	-buildid id
+		Record id as Go toolchain build id.
 	-buildmode mode
 		Set build mode (default exe).
+	-c
+		Dump call graphs.
+	-compressdwarf
+		Compress DWARF if possible (default true).
 	-cpuprofile file
 		Write CPU profile to file.
 	-d
@@ -54,6 +62,10 @@
 		The dynamic header is on by default, even without any
 		references to dynamic libraries, because many common
 		system tools now assume the presence of the header.
+	-debugtramp int
+		Debug trampolines.
+	-dumpdep
+		Dump symbol dependency graph.
 	-extar ar
 		Set the external archive program (default "ar").
 		Used only for -buildmode=c-archive.
@@ -65,9 +77,14 @@
 		Ignore version mismatch in the linked archives.
 	-g
 		Disable Go package data checks.
+	-importcfg file
+		Read import configuration from file.
+		In the file, set packagefile, packageshlib to specify import resolution.
 	-installsuffix suffix
 		Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix
 		instead of $GOROOT/pkg/$GOOS_$GOARCH.
+	-k symbol
+		Set field tracking symbol. Use this flag when GOEXPERIMENT=fieldtrack is set.
 	-libgcc file
 		Set name of compiler support library.
 		This is only used in internal link mode.
@@ -85,6 +102,8 @@
 		Set runtime.MemProfileRate to rate.
 	-msan
 		Link with C/C++ memory sanitizer support.
+	-n
+		Dump symbol table.
 	-o file
 		Write output to file (default a.out, or a.out.exe on Windows).
 	-pluginpath path
@@ -100,6 +119,8 @@
 	-tmpdir dir
 		Write temporary files to dir.
 		Temporary files are only used in external linking mode.
+	-u
+		Reject unsafe packages.
 	-v
 		Print trace of linker operations.
 	-w
diff --git a/src/cmd/link/elf_test.go b/src/cmd/link/elf_test.go
new file mode 100644
index 0000000..3df9869
--- /dev/null
+++ b/src/cmd/link/elf_test.go
@@ -0,0 +1,113 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build dragonfly freebsd linux netbsd openbsd
+
+package main
+
+import (
+	"internal/testenv"
+	"io/ioutil"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"strings"
+	"testing"
+)
+
+var asmSource = `
+	.section .text1,"ax"
+s1:
+	.byte 0
+	.section .text2,"ax"
+s2:
+	.byte 0
+`
+
+var goSource = `
+package main
+func main() {}
+`
+
+// The linker used to crash if an ELF input file had multiple text sections
+// with the same name.
+func TestSectionsWithSameName(t *testing.T) {
+	testenv.MustHaveGoBuild(t)
+	testenv.MustHaveCGO(t)
+	t.Parallel()
+
+	objcopy, err := exec.LookPath("objcopy")
+	if err != nil {
+		t.Skipf("can't find objcopy: %v", err)
+	}
+
+	dir, err := ioutil.TempDir("", "go-link-TestSectionsWithSameName")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer os.RemoveAll(dir)
+
+	gopath := filepath.Join(dir, "GOPATH")
+	env := append(os.Environ(), "GOPATH="+gopath)
+
+	if err := ioutil.WriteFile(filepath.Join(dir, "go.mod"), []byte("module elf_test\n"), 0666); err != nil {
+		t.Fatal(err)
+	}
+
+	asmFile := filepath.Join(dir, "x.s")
+	if err := ioutil.WriteFile(asmFile, []byte(asmSource), 0444); err != nil {
+		t.Fatal(err)
+	}
+
+	goTool := testenv.GoToolPath(t)
+	cmd := exec.Command(goTool, "env", "CC")
+	cmd.Env = env
+	ccb, err := cmd.Output()
+	if err != nil {
+		t.Fatal(err)
+	}
+	cc := strings.TrimSpace(string(ccb))
+
+	cmd = exec.Command(goTool, "env", "GOGCCFLAGS")
+	cmd.Env = env
+	cflagsb, err := cmd.Output()
+	if err != nil {
+		t.Fatal(err)
+	}
+	cflags := strings.Fields(string(cflagsb))
+
+	asmObj := filepath.Join(dir, "x.o")
+	t.Logf("%s %v -c -o %s %s", cc, cflags, asmObj, asmFile)
+	if out, err := exec.Command(cc, append(cflags, "-c", "-o", asmObj, asmFile)...).CombinedOutput(); err != nil {
+		t.Logf("%s", out)
+		t.Fatal(err)
+	}
+
+	asm2Obj := filepath.Join(dir, "x2.syso")
+	t.Logf("%s --rename-section .text2=.text1 %s %s", objcopy, asmObj, asm2Obj)
+	if out, err := exec.Command(objcopy, "--rename-section", ".text2=.text1", asmObj, asm2Obj).CombinedOutput(); err != nil {
+		t.Logf("%s", out)
+		t.Fatal(err)
+	}
+
+	for _, s := range []string{asmFile, asmObj} {
+		if err := os.Remove(s); err != nil {
+			t.Fatal(err)
+		}
+	}
+
+	goFile := filepath.Join(dir, "main.go")
+	if err := ioutil.WriteFile(goFile, []byte(goSource), 0444); err != nil {
+		t.Fatal(err)
+	}
+
+	cmd = exec.Command(goTool, "build")
+	cmd.Dir = dir
+	cmd.Env = env
+	t.Logf("%s build", goTool)
+	if out, err := cmd.CombinedOutput(); err != nil {
+		t.Logf("%s", out)
+		t.Fatal(err)
+	}
+}
diff --git a/src/cmd/link/internal/ld/link.go b/src/cmd/link/internal/ld/link.go
index f3f1bba..8ed5c6e 100644
--- a/src/cmd/link/internal/ld/link.go
+++ b/src/cmd/link/internal/ld/link.go
@@ -113,15 +113,16 @@
 		// Try to find symbol under another ABI.
 		var reqABI, haveABI obj.ABI
 		haveABI = ^obj.ABI(0)
-		for abi := obj.ABI(0); abi < obj.ABICount; abi++ {
-			v := sym.ABIToVersion(abi)
-			if v == -1 {
-				continue
-			}
-			if v == int(r.Sym.Version) {
-				reqABI = abi
-			} else if ctxt.Syms.ROLookup(r.Sym.Name, v) != nil {
-				haveABI = abi
+		reqABI, ok := sym.VersionToABI(int(r.Sym.Version))
+		if ok {
+			for abi := obj.ABI(0); abi < obj.ABICount; abi++ {
+				v := sym.ABIToVersion(abi)
+				if v == -1 {
+					continue
+				}
+				if rs := ctxt.Syms.ROLookup(r.Sym.Name, v); rs != nil && rs.Type != sym.Sxxx {
+					haveABI = abi
+				}
 			}
 		}
 
diff --git a/src/cmd/link/internal/loadelf/ldelf.go b/src/cmd/link/internal/loadelf/ldelf.go
index d85d919..251146d 100644
--- a/src/cmd/link/internal/loadelf/ldelf.go
+++ b/src/cmd/link/internal/loadelf/ldelf.go
@@ -678,6 +678,8 @@
 	// as well use one large chunk.
 
 	// create symbols for elfmapped sections
+	sectsymNames := make(map[string]bool)
+	counter := 0
 	for i := 0; uint(i) < elfobj.nsect; i++ {
 		sect = &elfobj.sect[i]
 		if sect.type_ == SHT_ARM_ATTRIBUTES && sect.name == ".ARM.attributes" {
@@ -709,6 +711,12 @@
 		}
 
 		name := fmt.Sprintf("%s(%s)", pkg, sect.name)
+		for sectsymNames[name] {
+			counter++
+			name = fmt.Sprintf("%s(%s%d)", pkg, sect.name, counter)
+		}
+		sectsymNames[name] = true
+
 		s := syms.Lookup(name, localSymVersion)
 
 		switch int(sect.flags) & (ElfSectFlagAlloc | ElfSectFlagWrite | ElfSectFlagExec) {
diff --git a/src/cmd/link/internal/sym/symbol.go b/src/cmd/link/internal/sym/symbol.go
index 24b0d68..8b70d61 100644
--- a/src/cmd/link/internal/sym/symbol.go
+++ b/src/cmd/link/internal/sym/symbol.go
@@ -68,6 +68,16 @@
 	return -1
 }
 
+func VersionToABI(v int) (obj.ABI, bool) {
+	switch v {
+	case SymVerABI0:
+		return obj.ABI0, true
+	case SymVerABIInternal:
+		return obj.ABIInternal, true
+	}
+	return ^obj.ABI(0), false
+}
+
 func (s *Symbol) String() string {
 	if s.Version == 0 {
 		return s.Name
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
index 6ed751a..e0aae02 100644
--- a/src/cmd/link/link_test.go
+++ b/src/cmd/link/link_test.go
@@ -6,6 +6,7 @@
 	"os"
 	"os/exec"
 	"path/filepath"
+	"regexp"
 	"strings"
 	"testing"
 )
@@ -116,3 +117,57 @@
 	// to compile the extra section.
 	runGo("tool", "link", "main.a")
 }
+
+func TestUnresolved(t *testing.T) {
+	testenv.MustHaveGoBuild(t)
+
+	tmpdir, err := ioutil.TempDir("", "unresolved-")
+	if err != nil {
+		t.Fatalf("failed to create temp dir: %v", err)
+	}
+	defer os.RemoveAll(tmpdir)
+
+	write := func(name, content string) {
+		err := ioutil.WriteFile(filepath.Join(tmpdir, name), []byte(content), 0666)
+		if err != nil {
+			t.Fatal(err)
+		}
+	}
+
+	// Test various undefined references. Because of issue #29852,
+	// this used to give confusing error messages because the
+	// linker would find an undefined reference to "zero" created
+	// by the runtime package.
+
+	write("main.go", `package main
+
+func main() {
+        x()
+}
+
+func x()
+`)
+	write("main.s", `
+TEXT ·x(SB),0,$0
+        MOVD zero<>(SB), AX
+        MOVD zero(SB), AX
+        MOVD ·zero(SB), AX
+        RET
+`)
+	cmd := exec.Command(testenv.GoToolPath(t), "build")
+	cmd.Dir = tmpdir
+	cmd.Env = append(os.Environ(), []string{"GOARCH=amd64", "GOOS=linux"}...)
+	out, err := cmd.CombinedOutput()
+	if err == nil {
+		t.Fatalf("expected build to fail, but it succeeded")
+	}
+	out = regexp.MustCompile("(?m)^#.*\n").ReplaceAll(out, nil)
+	got := string(out)
+	want := `main.x: relocation target zero not defined
+main.x: relocation target zero not defined
+main.x: relocation target main.zero not defined
+`
+	if want != got {
+		t.Fatalf("want:\n%sgot:\n%s", want, got)
+	}
+}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go
index 21baa02..4d8a6e5 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go
@@ -87,6 +87,7 @@
 	OtherFiles []string       // names of non-Go files of this package
 	Pkg        *types.Package // type information about the package
 	TypesInfo  *types.Info    // type information about the syntax trees
+	TypesSizes types.Sizes    // function for computing sizes of types
 
 	// Report reports a Diagnostic, a finding about a specific location
 	// in the analyzed source code such as a potential mistake.
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go
index f925849..2d44b04 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/doc.go
@@ -246,7 +246,7 @@
 
 	var Analyzer = &analysis.Analyzer{
 		Name:       "printf",
-		FactTypes: []reflect.Type{reflect.TypeOf(new(isWrapper))},
+		FactTypes: []analysis.Fact{new(isWrapper)},
 		...
 	}
 
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
index dce1ef7..6403d77 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
@@ -114,7 +114,8 @@
 			// library we cannot assume types.SizesFor is consistent with arches.
 			// For now, assume 64-bit norms and print a warning.
 			// But this warning should really be deferred until we attempt to use
-			// arch, which is very unlikely.
+			// arch, which is very unlikely. Better would be
+			// to defer size computation until we have Pass.TypesSizes.
 			arch.sizes = types.SizesFor("gc", "amd64")
 			log.Printf("unknown architecture %s", arch.name)
 		}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go
index 993f1ce..1e4fac8 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go
@@ -9,7 +9,6 @@
 import (
 	"fmt"
 	"go/ast"
-	"go/build"
 	"go/format"
 	"go/parser"
 	"go/token"
@@ -45,7 +44,7 @@
 		return nil, nil // doesn't use cgo
 	}
 
-	cgofiles, info, err := typeCheckCgoSourceFiles(pass.Fset, pass.Pkg, pass.Files, pass.TypesInfo)
+	cgofiles, info, err := typeCheckCgoSourceFiles(pass.Fset, pass.Pkg, pass.Files, pass.TypesInfo, pass.TypesSizes)
 	if err != nil {
 		return nil, err
 	}
@@ -171,7 +170,7 @@
 // limited ourselves here to preserving function bodies and initializer
 // expressions since that is all that the cgocall analyzer needs.
 //
-func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*ast.File, info *types.Info) ([]*ast.File, *types.Info, error) {
+func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*ast.File, info *types.Info, sizes types.Sizes) ([]*ast.File, *types.Info, error) {
 	const thispkg = "·this·"
 
 	// Which files are cgo files?
@@ -269,8 +268,7 @@
 		Importer: importerFunc(func(path string) (*types.Package, error) {
 			return importMap[path], nil
 		}),
-		// TODO(adonovan): Sizes should probably be provided by analysis.Pass.
-		Sizes: types.SizesFor("gc", build.Default.GOARCH),
+		Sizes: sizes,
 		Error: func(error) {}, // ignore errors (e.g. unused import)
 	}
 
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go
index 9cca778..2abe7c6 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go
@@ -21,7 +21,16 @@
 This analyzer reports a diagnostic for composite literals of struct
 types imported from another package that do not use the field-keyed
 syntax. Such literals are fragile because the addition of a new field
-(even if unexported) to the struct will cause compilation to fail.`
+(even if unexported) to the struct will cause compilation to fail.
+
+As an example,
+
+	err = &net.DNSConfigError{err}
+
+should be replaced by:
+
+	err = &net.DNSConfigError{Err: err}
+`
 
 var Analyzer = &analysis.Analyzer{
 	Name:             "composites",
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go
index bd06549..8213f63 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go
@@ -8,7 +8,11 @@
 //
 // Example of use in another analysis:
 //
-//	import "golang.org/x/tools/go/analysis/passes/inspect"
+//	import (
+//		"golang.org/x/tools/go/analysis"
+//		"golang.org/x/tools/go/analysis/passes/inspect"
+//		"golang.org/x/tools/go/ast/inspector"
+//	)
 //
 //	var Analyzer = &analysis.Analyzer{
 //		...
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
index c0265aa..b73ff5e 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
@@ -453,15 +453,23 @@
 }
 
 // isFormatter reports whether t satisfies fmt.Formatter.
-// Unlike fmt.Stringer, it's impossible to satisfy fmt.Formatter without importing fmt.
-func isFormatter(pass *analysis.Pass, t types.Type) bool {
-	for _, imp := range pass.Pkg.Imports() {
-		if imp.Path() == "fmt" {
-			formatter := imp.Scope().Lookup("Formatter").Type().Underlying().(*types.Interface)
-			return types.Implements(t, formatter)
-		}
+// The only interface method to look for is "Format(State, rune)".
+func isFormatter(typ types.Type) bool {
+	obj, _, _ := types.LookupFieldOrMethod(typ, false, nil, "Format")
+	fn, ok := obj.(*types.Func)
+	if !ok {
+		return false
 	}
-	return false
+	sig := fn.Type().(*types.Signature)
+	return sig.Params().Len() == 2 &&
+		sig.Results().Len() == 0 &&
+		isNamed(sig.Params().At(0).Type(), "fmt", "State") &&
+		types.Identical(sig.Params().At(1).Type(), types.Typ[types.Rune])
+}
+
+func isNamed(T types.Type, pkgpath, name string) bool {
+	named, ok := T.(*types.Named)
+	return ok && named.Obj().Pkg().Path() == pkgpath && named.Obj().Name() == name
 }
 
 // formatState holds the parsed representation of a printf directive such as "%3.*[4]d".
@@ -753,7 +761,7 @@
 	formatter := false
 	if state.argNum < len(call.Args) {
 		if tv, ok := pass.TypesInfo.Types[call.Args[state.argNum]]; ok {
-			formatter = isFormatter(pass, tv.Type)
+			formatter = isFormatter(tv.Type)
 		}
 	}
 
@@ -831,7 +839,7 @@
 	typ := pass.TypesInfo.Types[e].Type
 
 	// It's unlikely to be a recursive stringer if it has a Format method.
-	if isFormatter(pass, typ) {
+	if isFormatter(typ) {
 		return false
 	}
 
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go
index e881046..12286fd 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go
@@ -2,7 +2,6 @@
 
 import (
 	"go/ast"
-	"go/build"
 	"go/types"
 
 	"golang.org/x/tools/go/analysis"
@@ -39,7 +38,7 @@
 		}
 	}
 	// If the type implements fmt.Formatter, we have nothing to check.
-	if isFormatter(pass, typ) {
+	if isFormatter(typ) {
 		return true
 	}
 	// If we can use a string, might arg (dynamically) implement the Stringer or Error interface?
@@ -235,5 +234,3 @@
 	}
 	return true
 }
-
-var archSizes = types.SizesFor("gc", build.Default.GOARCH)
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go
index 56b150b..39f5457 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/shift/shift.go
@@ -12,10 +12,8 @@
 
 import (
 	"go/ast"
-	"go/build"
 	"go/constant"
 	"go/token"
-	"go/types"
 
 	"golang.org/x/tools/go/analysis"
 	"golang.org/x/tools/go/analysis/passes/inspect"
@@ -93,36 +91,9 @@
 	if t == nil {
 		return
 	}
-	b, ok := t.Underlying().(*types.Basic)
-	if !ok {
-		return
-	}
-	var size int64
-	switch b.Kind() {
-	case types.Uint8, types.Int8:
-		size = 8
-	case types.Uint16, types.Int16:
-		size = 16
-	case types.Uint32, types.Int32:
-		size = 32
-	case types.Uint64, types.Int64:
-		size = 64
-	case types.Int, types.Uint:
-		size = uintBitSize
-	case types.Uintptr:
-		size = uintptrBitSize
-	default:
-		return
-	}
+	size := 8 * pass.TypesSizes.Sizeof(t)
 	if amt >= size {
 		ident := analysisutil.Format(pass.Fset, x)
 		pass.Reportf(node.Pos(), "%s (%d bits) too small for shift of %d", ident, size, amt)
 	}
 }
-
-var (
-	uintBitSize    = 8 * archSizes.Sizeof(types.Typ[types.Uint])
-	uintptrBitSize = 8 * archSizes.Sizeof(types.Typ[types.Uintptr])
-)
-
-var archSizes = types.SizesFor("gc", build.Default.GOARCH)
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
index 2b67c37..5b27208 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
@@ -96,6 +96,11 @@
 	}
 	if val == "" || val[0] == ',' {
 		if field.Anonymous() {
+			// Disable this check enhancement in Go 1.12.1; some
+			// false positives were spotted in the initial 1.12
+			// release. See https://golang.org/issues/30465.
+			return
+
 			typ, ok := field.Type().Underlying().(*types.Struct)
 			if !ok {
 				return
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
index 76dabc2..ba2e66f 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
@@ -329,6 +329,7 @@
 				OtherFiles:        cfg.NonGoFiles,
 				Pkg:               pkg,
 				TypesInfo:         info,
+				TypesSizes:        tc.Sizes,
 				ResultOf:          inputs,
 				Report:            func(d analysis.Diagnostic) { act.diagnostics = append(act.diagnostics, d) },
 				ImportObjectFact:  facts.ImportObjectFact,
diff --git a/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go b/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go
index db88a95..ddbdd3f 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/ast/inspector/inspector.go
@@ -14,7 +14,7 @@
 // Experiments suggest the inspector's traversals are about 2.5x faster
 // than ast.Inspect, but it may take around 5 traversals for this
 // benefit to amortize the inspector's construction cost.
-// If efficiency is the primary concern, do not use use Inspector for
+// If efficiency is the primary concern, do not use Inspector for
 // one-off traversals.
 package inspector
 
diff --git a/src/cmd/vet/testdata/src/print2/big.go b/src/cmd/vet/testdata/src/print2/big.go
new file mode 100644
index 0000000..dd5bef5
--- /dev/null
+++ b/src/cmd/vet/testdata/src/print2/big.go
@@ -0,0 +1,17 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package print2
+
+import ( // NOTE: Does not import "fmt"
+	"log"
+	"math/big"
+)
+
+var fmt int
+
+func f() {
+	log.Printf("%d", new(big.Int))
+	log.Printf("%d", 1.0) // ERROR "Printf format %d has arg 1.0 of wrong type float64"
+}
diff --git a/src/cmd/vet/testdata/src/structtag/structtag.go b/src/cmd/vet/testdata/src/structtag/structtag.go
index cbcc453..e40139e 100644
--- a/src/cmd/vet/testdata/src/structtag/structtag.go
+++ b/src/cmd/vet/testdata/src/structtag/structtag.go
@@ -6,6 +6,20 @@
 
 package structtag
 
+import "encoding/json"
+
 type StructTagTest struct {
 	A int "hello" // ERROR "`hello` not compatible with reflect.StructTag.Get: bad syntax for struct tag pair"
 }
+
+func Issue30465() {
+	type T1 struct {
+		X string `json:"x"`
+	}
+	type T2 struct {
+		T1
+		X string `json:"x"`
+	}
+	var t2 T2
+	json.Marshal(&t2)
+}
diff --git a/src/cmd/vet/vet_test.go b/src/cmd/vet/vet_test.go
index d106c5c..f3b9a56 100644
--- a/src/cmd/vet/vet_test.go
+++ b/src/cmd/vet/vet_test.go
@@ -88,6 +88,7 @@
 		"method",
 		"nilfunc",
 		"print",
+		"print2",
 		"rangeloop",
 		"shift",
 		"structtag",
diff --git a/src/crypto/aes/block.go b/src/crypto/aes/block.go
index 40bd0d3..53308ae 100644
--- a/src/crypto/aes/block.go
+++ b/src/crypto/aes/block.go
@@ -31,7 +31,7 @@
 //
 // See FIPS 197 for specification, and see Daemen and Rijmen's Rijndael submission
 // for implementation details.
-//	https://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf
+//	https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf
 //	https://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf
 
 package aes
diff --git a/src/crypto/elliptic/elliptic.go b/src/crypto/elliptic/elliptic.go
index 4fc2b5e..c84657c 100644
--- a/src/crypto/elliptic/elliptic.go
+++ b/src/crypto/elliptic/elliptic.go
@@ -210,8 +210,9 @@
 
 	x3 := new(big.Int).Mul(alpha, alpha)
 	beta8 := new(big.Int).Lsh(beta, 3)
+	beta8.Mod(beta8, curve.P)
 	x3.Sub(x3, beta8)
-	for x3.Sign() == -1 {
+	if x3.Sign() == -1 {
 		x3.Add(x3, curve.P)
 	}
 	x3.Mod(x3, curve.P)
diff --git a/src/crypto/rc4/rc4.go b/src/crypto/rc4/rc4.go
index d5e6ebc..c2df0db 100644
--- a/src/crypto/rc4/rc4.go
+++ b/src/crypto/rc4/rc4.go
@@ -45,8 +45,10 @@
 	return &c, nil
 }
 
-// Reset zeros the key data so that it will no longer appear in the
-// process's memory.
+// Reset zeros the key data and makes the Cipher unusable.
+//
+// Deprecated: Reset can't guarantee that the key will be entirely removed from
+// the process's memory.
 func (c *Cipher) Reset() {
 	for i := range c.s {
 		c.s[i] = 0
diff --git a/src/crypto/subtle/constant_time.go b/src/crypto/subtle/constant_time.go
index 9f5fee8..7c3cf05 100644
--- a/src/crypto/subtle/constant_time.go
+++ b/src/crypto/subtle/constant_time.go
@@ -6,9 +6,9 @@
 // code but require careful thought to use correctly.
 package subtle
 
-// ConstantTimeCompare returns 1 if and only if the two slices, x
-// and y, have equal contents. The time taken is a function of the length of
-// the slices and is independent of the contents.
+// ConstantTimeCompare returns 1 if the two slices, x and y, have equal contents
+// and 0 otherwise. The time taken is a function of the length of the slices and
+// is independent of the contents.
 func ConstantTimeCompare(x, y []byte) int {
 	if len(x) != len(y) {
 		return 0
@@ -23,7 +23,7 @@
 	return ConstantTimeByteEq(v, 0)
 }
 
-// ConstantTimeSelect returns x if v is 1 and y if v is 0.
+// ConstantTimeSelect returns x if v == 1 and y if v == 0.
 // Its behavior is undefined if v takes any other value.
 func ConstantTimeSelect(v, x, y int) int { return ^(v-1)&x | (v-1)&y }
 
diff --git a/src/crypto/tls/common.go b/src/crypto/tls/common.go
index 0bc40cc..f695528 100644
--- a/src/crypto/tls/common.go
+++ b/src/crypto/tls/common.go
@@ -16,6 +16,7 @@
 	"io"
 	"math/big"
 	"net"
+	"os"
 	"strings"
 	"sync"
 	"time"
@@ -160,7 +161,7 @@
 )
 
 // supportedSignatureAlgorithms contains the signature and hash algorithms that
-// the code advertises as supported in a TLS 1.2 ClientHello and in a TLS 1.2
+// the code advertises as supported in a TLS 1.2+ ClientHello and in a TLS 1.2+
 // CertificateRequest. The two fields are merged to match with TLS 1.3.
 // Note that in TLS 1.2, the ECDSA algorithms are not constrained to P-256, etc.
 var supportedSignatureAlgorithms = []SignatureScheme{
@@ -177,6 +178,9 @@
 	ECDSAWithSHA1,
 }
 
+// RSA-PSS is disabled in TLS 1.2 for Go 1.12. See Issue 30055.
+var supportedSignatureAlgorithmsTLS12 = supportedSignatureAlgorithms[3:]
+
 // helloRetryRequestRandom is set as the Random value of a ServerHello
 // to signal that the message is actually a HelloRetryRequest.
 var helloRetryRequestRandom = []byte{ // See RFC 8446, Section 4.1.3.
@@ -199,7 +203,7 @@
 	Version                     uint16                // TLS version used by the connection (e.g. VersionTLS12)
 	HandshakeComplete           bool                  // TLS handshake is complete
 	DidResume                   bool                  // connection resumes a previous TLS connection
-	CipherSuite                 uint16                // cipher suite in use (TLS_RSA_WITH_RC4_128_SHA, ...)
+	CipherSuite                 uint16                // cipher suite in use (TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, ...)
 	NegotiatedProtocol          string                // negotiated next protocol (not guaranteed to be from Config.NextProtos)
 	NegotiatedProtocolIsMutual  bool                  // negotiated protocol was advertised by server (client side only)
 	ServerName                  string                // server name requested by client, if any (server side only)
@@ -315,7 +319,7 @@
 // guide certificate selection in the GetCertificate callback.
 type ClientHelloInfo struct {
 	// CipherSuites lists the CipherSuites supported by the client (e.g.
-	// TLS_RSA_WITH_RC4_128_SHA).
+	// TLS_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256).
 	CipherSuites []uint16
 
 	// ServerName indicates the name of the server requested by the client
@@ -521,8 +525,11 @@
 	// This should be used only for testing.
 	InsecureSkipVerify bool
 
-	// CipherSuites is a list of supported cipher suites. If CipherSuites
-	// is nil, TLS uses a list of suites supported by the implementation.
+	// CipherSuites is a list of supported cipher suites for TLS versions up to
+	// TLS 1.2. If CipherSuites is nil, a default list of secure cipher suites
+	// is used, with a preference order based on hardware performance. The
+	// default cipher suites might change over Go versions. Note that TLS 1.3
+	// ciphersuites are not configurable.
 	CipherSuites []uint16
 
 	// PreferServerCipherSuites controls whether the server selects the
@@ -772,11 +779,53 @@
 		if isClient && v < VersionTLS10 {
 			continue
 		}
+		// TLS 1.3 is opt-in in Go 1.12.
+		if v == VersionTLS13 && !isTLS13Supported() {
+			continue
+		}
 		versions = append(versions, v)
 	}
 	return versions
 }
 
+// tls13Support caches the result for isTLS13Supported.
+var tls13Support struct {
+	sync.Once
+	cached bool
+}
+
+// isTLS13Supported returns whether the program opted into TLS 1.3 via
+// GODEBUG=tls13=1. It's cached after the first execution.
+func isTLS13Supported() bool {
+	tls13Support.Do(func() {
+		tls13Support.cached = goDebugString("tls13") == "1"
+	})
+	return tls13Support.cached
+}
+
+// goDebugString returns the value of the named GODEBUG key.
+// GODEBUG is of the form "key=val,key2=val2".
+func goDebugString(key string) string {
+	s := os.Getenv("GODEBUG")
+	for i := 0; i < len(s)-len(key)-1; i++ {
+		if i > 0 && s[i-1] != ',' {
+			continue
+		}
+		afterKey := s[i+len(key):]
+		if afterKey[0] != '=' || s[i:i+len(key)] != key {
+			continue
+		}
+		val := afterKey[1:]
+		for i, b := range val {
+			if b == ',' {
+				return val[:i]
+			}
+		}
+		return val
+	}
+	return ""
+}
+
 func (c *Config) maxSupportedVersion(isClient bool) uint16 {
 	supportedVersions := c.supportedVersions(isClient)
 	if len(supportedVersions) == 0 {
diff --git a/src/crypto/tls/conn_test.go b/src/crypto/tls/conn_test.go
index 76cef71..57f6105 100644
--- a/src/crypto/tls/conn_test.go
+++ b/src/crypto/tls/conn_test.go
@@ -142,6 +142,7 @@
 
 	handshakeDone := make(chan struct{})
 	recordSizesChan := make(chan []int, 1)
+	defer func() { <-recordSizesChan }() // wait for the goroutine to exit
 	go func() {
 		// This goroutine performs a TLS handshake over clientConn and
 		// then reads TLS records until EOF. It writes a slice that
diff --git a/src/crypto/tls/handshake_client.go b/src/crypto/tls/handshake_client.go
index ca74989..e760fbf 100644
--- a/src/crypto/tls/handshake_client.go
+++ b/src/crypto/tls/handshake_client.go
@@ -573,7 +573,7 @@
 			return fmt.Errorf("tls: client certificate private key of type %T does not implement crypto.Signer", chainToSend.PrivateKey)
 		}
 
-		signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(key.Public(), certReq.supportedSignatureAlgorithms, hs.hello.supportedSignatureAlgorithms, c.vers)
+		signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(key.Public(), certReq.supportedSignatureAlgorithms, supportedSignatureAlgorithmsTLS12, c.vers)
 		if err != nil {
 			c.sendAlert(alertInternalError)
 			return err
diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
index ececd7b..8c4125b 100644
--- a/src/crypto/tls/handshake_client_test.go
+++ b/src/crypto/tls/handshake_client_test.go
@@ -855,6 +855,61 @@
 	runClientTestTLS12(t, test)
 }
 
+func TestHandshakeClientCertPSSDisabled(t *testing.T) {
+	config := testConfig.Clone()
+	cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM))
+	config.Certificates = []Certificate{cert}
+
+	test := &clientTest{
+		name:   "ClientCert-RSA-PSS-Disabled",
+		args:   []string{"-cipher", "AES128", "-Verify", "1"},
+		config: config,
+	}
+
+	// Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2,
+	// and check that handshakes still work.
+	testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12
+	defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }()
+	supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12
+
+	// Use t.Run to ensure the defer runs after all parallel tests end.
+	t.Run("1024", func(t *testing.T) {
+		runClientTestTLS12(t, test)
+		runClientTestTLS13(t, test)
+	})
+
+	// Use a 512-bit key to check that the TLS 1.2 handshake is actually using
+	// PKCS#1 v1.5. PSS would be failing here.
+	cert, err := X509KeyPair([]byte(`-----BEGIN CERTIFICATE-----
+MIIBcTCCARugAwIBAgIQGjQnkCFlUqaFlt6ixyz/tDANBgkqhkiG9w0BAQsFADAS
+MRAwDgYDVQQKEwdBY21lIENvMB4XDTE5MDExODIzMjMyOFoXDTIwMDExODIzMjMy
+OFowEjEQMA4GA1UEChMHQWNtZSBDbzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDd
+ez1rFUDwax2HTxbcnFUP9AhcgEGMHVV2nn4VVEWFJB6I8C/Nkx0XyyQlrmFYBzEQ
+nIPhKls4T0hFoLvjJnXpAgMBAAGjTTBLMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE
+DDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUu
+Y29tMA0GCSqGSIb3DQEBCwUAA0EAxDuUS+BrrS3c+h+k+fQPOmOScy6yTX9mHw0Q
+KbucGamXYEy0URIwOdO0tQ3LHPc1YGvYSPwkDjkjqECs2Vm/AA==
+-----END CERTIFICATE-----`), []byte(`-----BEGIN RSA PRIVATE KEY-----
+MIIBOgIBAAJBAN17PWsVQPBrHYdPFtycVQ/0CFyAQYwdVXaefhVURYUkHojwL82T
+HRfLJCWuYVgHMRCcg+EqWzhPSEWgu+MmdekCAwEAAQJBALjQYNTdXF4CFBbXwUz/
+yt9QFDYT9B5WT/12jeGAe653gtYS6OOi/+eAkGmzg1GlRnw6fOfn+HYNFDORST7z
+4j0CIQDn2xz9hVWQEu9ee3vecNT3f60huDGTNoRhtqgweQGX0wIhAPSLj1VcRZEz
+nKpbtU22+PbIMSJ+e80fmY9LIPx5N4HTAiAthGSimMR9bloz0EY3GyuUEyqoDgMd
+hXxjuno2WesoJQIgemilbcALXpxsLmZLgcQ2KSmaVr7jb5ECx9R+hYKTw1sCIG4s
+T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g
+-----END RSA PRIVATE KEY-----`))
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	test.name = "ClientCert-RSA-PSS-Disabled-512"
+	config.Certificates = []Certificate{cert}
+
+	t.Run("512", func(t *testing.T) {
+		runClientTestTLS12(t, test)
+	})
+}
+
 func TestClientKeyUpdate(t *testing.T) {
 	test := &clientTest{
 		name:          "KeyUpdate",
diff --git a/src/crypto/tls/handshake_server.go b/src/crypto/tls/handshake_server.go
index 2745f33..4f4b60a 100644
--- a/src/crypto/tls/handshake_server.go
+++ b/src/crypto/tls/handshake_server.go
@@ -463,7 +463,7 @@
 		}
 		if c.vers >= VersionTLS12 {
 			certReq.hasSignatureAlgorithm = true
-			certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms
+			certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithmsTLS12
 		}
 
 		// An empty list of certificateAuthorities signals to
@@ -559,7 +559,7 @@
 		}
 
 		// Determine the signature type.
-		_, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, supportedSignatureAlgorithms, c.vers)
+		_, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, supportedSignatureAlgorithmsTLS12, c.vers)
 		if err != nil {
 			c.sendAlert(alertIllegalParameter)
 			return err
diff --git a/src/crypto/tls/handshake_server_test.go b/src/crypto/tls/handshake_server_test.go
index a6240f2..c23f98f 100644
--- a/src/crypto/tls/handshake_server_test.go
+++ b/src/crypto/tls/handshake_server_test.go
@@ -1211,6 +1211,33 @@
 	runServerTestTLS13(t, test)
 }
 
+func TestHandshakeServerPSSDisabled(t *testing.T) {
+	test := &serverTest{
+		name:    "RSA-PSS-Disabled",
+		command: []string{"openssl", "s_client", "-no_ticket"},
+		wait:    true,
+	}
+
+	// Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2,
+	// and check that handshakes still work.
+	testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12
+	defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }()
+	supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12
+
+	runServerTestTLS12(t, test)
+	runServerTestTLS13(t, test)
+
+	test = &serverTest{
+		name:    "RSA-PSS-Disabled-Required",
+		command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"},
+		wait:    true,
+
+		expectHandshakeErrorIncluding: "peer doesn't support any common signature algorithms",
+	}
+
+	runServerTestTLS12(t, test)
+}
+
 func benchmarkHandshakeServer(b *testing.B, version uint16, cipherSuite uint16, curve CurveID, cert []byte, key crypto.PrivateKey) {
 	config := testConfig.Clone()
 	config.CipherSuites = []uint16{cipherSuite}
@@ -1390,49 +1417,82 @@
 		defer os.Remove(ecdsaCertPath)
 		ecdsaKeyPath = tempFile(clientECDSAKeyPEM)
 		defer os.Remove(ecdsaKeyPath)
-	} else {
-		t.Parallel()
 	}
 
-	config := testConfig.Clone()
-	config.ClientAuth = RequestClientCert
+	t.Run("Normal", func(t *testing.T) {
+		config := testConfig.Clone()
+		config.ClientAuth = RequestClientCert
 
-	test := &serverTest{
-		name:    "ClientAuthRequestedNotGiven",
-		command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"},
-		config:  config,
-	}
-	runServerTestTLS12(t, test)
-	runServerTestTLS13(t, test)
+		test := &serverTest{
+			name:    "ClientAuthRequestedNotGiven",
+			command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"},
+			config:  config,
+		}
+		runServerTestTLS12(t, test)
+		runServerTestTLS13(t, test)
 
-	test = &serverTest{
-		name: "ClientAuthRequestedAndGiven",
-		command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
-			"-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pss_rsae_sha256"},
-		config:            config,
-		expectedPeerCerts: []string{clientCertificatePEM},
-	}
-	runServerTestTLS12(t, test)
-	runServerTestTLS13(t, test)
+		config.ClientAuth = RequireAnyClientCert
 
-	test = &serverTest{
-		name: "ClientAuthRequestedAndECDSAGiven",
-		command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
-			"-cert", ecdsaCertPath, "-key", ecdsaKeyPath},
-		config:            config,
-		expectedPeerCerts: []string{clientECDSACertificatePEM},
-	}
-	runServerTestTLS12(t, test)
-	runServerTestTLS13(t, test)
+		test = &serverTest{
+			name: "ClientAuthRequestedAndGiven",
+			command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
+				"-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pss_rsae_sha256"},
+			config:            config,
+			expectedPeerCerts: []string{clientCertificatePEM},
+		}
+		runServerTestTLS12(t, test)
+		runServerTestTLS13(t, test)
 
-	test = &serverTest{
-		name: "ClientAuthRequestedAndPKCS1v15Given",
-		command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
-			"-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pkcs1_sha256"},
-		config:            config,
-		expectedPeerCerts: []string{clientCertificatePEM},
-	}
-	runServerTestTLS12(t, test)
+		test = &serverTest{
+			name: "ClientAuthRequestedAndECDSAGiven",
+			command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
+				"-cert", ecdsaCertPath, "-key", ecdsaKeyPath},
+			config:            config,
+			expectedPeerCerts: []string{clientECDSACertificatePEM},
+		}
+		runServerTestTLS12(t, test)
+		runServerTestTLS13(t, test)
+
+		test = &serverTest{
+			name: "ClientAuthRequestedAndPKCS1v15Given",
+			command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
+				"-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pkcs1_sha256"},
+			config:            config,
+			expectedPeerCerts: []string{clientCertificatePEM},
+		}
+		runServerTestTLS12(t, test)
+	})
+
+	// Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2,
+	// and check that handshakes still work.
+	testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12
+	defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }()
+	supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12
+
+	t.Run("PSSDisabled", func(t *testing.T) {
+		config := testConfig.Clone()
+		config.ClientAuth = RequireAnyClientCert
+
+		test := &serverTest{
+			name: "ClientAuthRequestedAndGiven-PSS-Disabled",
+			command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
+				"-cert", certPath, "-key", keyPath},
+			config:            config,
+			expectedPeerCerts: []string{clientCertificatePEM},
+		}
+		runServerTestTLS12(t, test)
+		runServerTestTLS13(t, test)
+
+		test = &serverTest{
+			name: "ClientAuthRequestedAndGiven-PSS-Disabled-Required",
+			command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
+				"-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"},
+			config: config,
+
+			expectHandshakeErrorIncluding: "client didn't provide a certificate",
+		}
+		runServerTestTLS12(t, test)
+	})
 }
 
 func TestSNIGivenOnFailure(t *testing.T) {
@@ -1697,3 +1757,58 @@
 		t.Error("cloned hash generated a different sum")
 	}
 }
+
+func TestKeyTooSmallForRSAPSS(t *testing.T) {
+	clientConn, serverConn := localPipe(t)
+	client := Client(clientConn, testConfig)
+	cert, err := X509KeyPair([]byte(`-----BEGIN CERTIFICATE-----
+MIIBcTCCARugAwIBAgIQGjQnkCFlUqaFlt6ixyz/tDANBgkqhkiG9w0BAQsFADAS
+MRAwDgYDVQQKEwdBY21lIENvMB4XDTE5MDExODIzMjMyOFoXDTIwMDExODIzMjMy
+OFowEjEQMA4GA1UEChMHQWNtZSBDbzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDd
+ez1rFUDwax2HTxbcnFUP9AhcgEGMHVV2nn4VVEWFJB6I8C/Nkx0XyyQlrmFYBzEQ
+nIPhKls4T0hFoLvjJnXpAgMBAAGjTTBLMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE
+DDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUu
+Y29tMA0GCSqGSIb3DQEBCwUAA0EAxDuUS+BrrS3c+h+k+fQPOmOScy6yTX9mHw0Q
+KbucGamXYEy0URIwOdO0tQ3LHPc1YGvYSPwkDjkjqECs2Vm/AA==
+-----END CERTIFICATE-----`), []byte(`-----BEGIN RSA PRIVATE KEY-----
+MIIBOgIBAAJBAN17PWsVQPBrHYdPFtycVQ/0CFyAQYwdVXaefhVURYUkHojwL82T
+HRfLJCWuYVgHMRCcg+EqWzhPSEWgu+MmdekCAwEAAQJBALjQYNTdXF4CFBbXwUz/
+yt9QFDYT9B5WT/12jeGAe653gtYS6OOi/+eAkGmzg1GlRnw6fOfn+HYNFDORST7z
+4j0CIQDn2xz9hVWQEu9ee3vecNT3f60huDGTNoRhtqgweQGX0wIhAPSLj1VcRZEz
+nKpbtU22+PbIMSJ+e80fmY9LIPx5N4HTAiAthGSimMR9bloz0EY3GyuUEyqoDgMd
+hXxjuno2WesoJQIgemilbcALXpxsLmZLgcQ2KSmaVr7jb5ECx9R+hYKTw1sCIG4s
+T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g
+-----END RSA PRIVATE KEY-----`))
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	done := make(chan struct{})
+	go func() {
+		config := testConfig.Clone()
+		config.Certificates = []Certificate{cert}
+		config.MinVersion = VersionTLS13
+		server := Server(serverConn, config)
+		err := server.Handshake()
+		if !strings.Contains(err.Error(), "key size too small for PSS signature") {
+			t.Errorf(`expected "key size too small for PSS signature", got %q`, err)
+		}
+		close(done)
+	}()
+	err = client.Handshake()
+	if !strings.Contains(err.Error(), "handshake failure") {
+		t.Errorf(`expected "handshake failure", got %q`, err)
+	}
+	<-done
+
+	// With RSA-PSS disabled and TLS 1.2, this should work.
+
+	testSupportedSignatureAlgorithmsTLS12 := supportedSignatureAlgorithmsTLS12
+	defer func() { supportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }()
+	supportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12
+
+	serverConfig := testConfig.Clone()
+	serverConfig.Certificates = []Certificate{cert}
+	serverConfig.MaxVersion = VersionTLS12
+	testHandshake(t, testConfig, serverConfig)
+}
diff --git a/src/crypto/tls/handshake_server_tls13.go b/src/crypto/tls/handshake_server_tls13.go
index 5f634b3..fd65ac1 100644
--- a/src/crypto/tls/handshake_server_tls13.go
+++ b/src/crypto/tls/handshake_server_tls13.go
@@ -635,7 +635,13 @@
 	}
 	sig, err := hs.cert.PrivateKey.(crypto.Signer).Sign(c.config.rand(), h.Sum(nil), signOpts)
 	if err != nil {
-		c.sendAlert(alertInternalError)
+		public := hs.cert.PrivateKey.(crypto.Signer).Public()
+		if rsaKey, ok := public.(*rsa.PublicKey); ok && sigType == signatureRSAPSS &&
+			rsaKey.N.BitLen()/8 < sigHash.Size()*2+2 { // key too small for RSA-PSS
+			c.sendAlert(alertHandshakeFailure)
+		} else {
+			c.sendAlert(alertInternalError)
+		}
 		return errors.New("tls: failed to sign handshake: " + err.Error())
 	}
 	certVerifyMsg.signature = sig
diff --git a/src/crypto/tls/key_agreement.go b/src/crypto/tls/key_agreement.go
index 628e578..05fe77b 100644
--- a/src/crypto/tls/key_agreement.go
+++ b/src/crypto/tls/key_agreement.go
@@ -177,7 +177,7 @@
 		return nil, errors.New("tls: certificate private key does not implement crypto.Signer")
 	}
 
-	signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(priv.Public(), clientHello.supportedSignatureAlgorithms, supportedSignatureAlgorithms, ka.version)
+	signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(priv.Public(), clientHello.supportedSignatureAlgorithms, supportedSignatureAlgorithmsTLS12, ka.version)
 	if err != nil {
 		return nil, err
 	}
diff --git a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled
new file mode 100644
index 0000000..71d26ea
--- /dev/null
+++ b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled
@@ -0,0 +1,137 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 f8 01 00 00  f4 03 03 00 00 00 00 00  |................|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 00 00 00 00 00  00 00 00 20 00 00 00 00  |........... ....|
+00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 32 cc a8  |.............2..|
+00000050  cc a9 c0 2f c0 2b c0 30  c0 2c c0 27 c0 13 c0 23  |.../.+.0.,.'...#|
+00000060  c0 09 c0 14 c0 0a 00 9c  00 9d 00 3c 00 2f 00 35  |...........<./.5|
+00000070  c0 12 00 0a 00 05 c0 11  c0 07 13 01 13 03 13 02  |................|
+00000080  01 00 00 79 00 05 00 05  01 00 00 00 00 00 0a 00  |...y............|
+00000090  0a 00 08 00 1d 00 17 00  18 00 19 00 0b 00 02 01  |................|
+000000a0  00 00 0d 00 18 00 16 08  04 08 05 08 06 04 01 04  |................|
+000000b0  03 05 01 05 03 06 01 06  03 02 01 02 03 ff 01 00  |................|
+000000c0  01 00 00 12 00 00 00 2b  00 09 08 03 04 03 03 03  |.......+........|
+000000d0  02 03 01 00 33 00 26 00  24 00 1d 00 20 2f e5 7d  |....3.&.$... /.}|
+000000e0  a3 47 cd 62 43 15 28 da  ac 5f bb 29 07 30 ff f6  |.G.bC.(.._.).0..|
+000000f0  84 af c4 cf c2 ed 90 99  5f 58 cb 3b 74           |........_X.;t|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 59 02 00 00  55 03 03 05 c1 62 2b 2f  |....Y...U....b+/|
+00000010  12 46 4d c5 47 61 bd 43  6d bb 3a 60 42 c1 cf da  |.FM.Ga.Cm.:`B...|
+00000020  47 96 0a 11 35 f0 71 d8  f6 39 69 20 0f 9c c1 3f  |G...5.q..9i ...?|
+00000030  9c 68 e7 86 13 7c 1f 83  6b 56 39 ee 0d c0 82 0b  |.h...|..kV9.....|
+00000040  24 1b 8a 39 a6 dc bf 57  79 27 02 e4 c0 2f 00 00  |$..9...Wy'.../..|
+00000050  0d ff 01 00 01 00 00 0b  00 04 03 00 01 02 16 03  |................|
+00000060  03 02 59 0b 00 02 55 00  02 52 00 02 4f 30 82 02  |..Y...U..R..O0..|
+00000070  4b 30 82 01 b4 a0 03 02  01 02 02 09 00 e8 f0 9d  |K0..............|
+00000080  3f e2 5b ea a6 30 0d 06  09 2a 86 48 86 f7 0d 01  |?.[..0...*.H....|
+00000090  01 0b 05 00 30 1f 31 0b  30 09 06 03 55 04 0a 13  |....0.1.0...U...|
+000000a0  02 47 6f 31 10 30 0e 06  03 55 04 03 13 07 47 6f  |.Go1.0...U....Go|
+000000b0  20 52 6f 6f 74 30 1e 17  0d 31 36 30 31 30 31 30  | Root0...1601010|
+000000c0  30 30 30 30 30 5a 17 0d  32 35 30 31 30 31 30 30  |00000Z..25010100|
+000000d0  30 30 30 30 5a 30 1a 31  0b 30 09 06 03 55 04 0a  |0000Z0.1.0...U..|
+000000e0  13 02 47 6f 31 0b 30 09  06 03 55 04 03 13 02 47  |..Go1.0...U....G|
+000000f0  6f 30 81 9f 30 0d 06 09  2a 86 48 86 f7 0d 01 01  |o0..0...*.H.....|
+00000100  01 05 00 03 81 8d 00 30  81 89 02 81 81 00 db 46  |.......0.......F|
+00000110  7d 93 2e 12 27 06 48 bc  06 28 21 ab 7e c4 b6 a2  |}...'.H..(!.~...|
+00000120  5d fe 1e 52 45 88 7a 36  47 a5 08 0d 92 42 5b c2  |]..RE.z6G....B[.|
+00000130  81 c0 be 97 79 98 40 fb  4f 6d 14 fd 2b 13 8b c2  |....y.@.Om..+...|
+00000140  a5 2e 67 d8 d4 09 9e d6  22 38 b7 4a 0b 74 73 2b  |..g....."8.J.ts+|
+00000150  c2 34 f1 d1 93 e5 96 d9  74 7b f3 58 9f 6c 61 3c  |.4......t{.X.la<|
+00000160  c0 b0 41 d4 d9 2b 2b 24  23 77 5b 1c 3b bd 75 5d  |..A..++$#w[.;.u]|
+00000170  ce 20 54 cf a1 63 87 1d  1e 24 c4 f3 1d 1a 50 8b  |. T..c...$....P.|
+00000180  aa b6 14 43 ed 97 a7 75  62 f4 14 c8 52 d7 02 03  |...C...ub...R...|
+00000190  01 00 01 a3 81 93 30 81  90 30 0e 06 03 55 1d 0f  |......0..0...U..|
+000001a0  01 01 ff 04 04 03 02 05  a0 30 1d 06 03 55 1d 25  |.........0...U.%|
+000001b0  04 16 30 14 06 08 2b 06  01 05 05 07 03 01 06 08  |..0...+.........|
+000001c0  2b 06 01 05 05 07 03 02  30 0c 06 03 55 1d 13 01  |+.......0...U...|
+000001d0  01 ff 04 02 30 00 30 19  06 03 55 1d 0e 04 12 04  |....0.0...U.....|
+000001e0  10 9f 91 16 1f 43 43 3e  49 a6 de 6d b6 80 d7 9f  |.....CC>I..m....|
+000001f0  60 30 1b 06 03 55 1d 23  04 14 30 12 80 10 48 13  |`0...U.#..0...H.|
+00000200  49 4d 13 7e 16 31 bb a3  01 d5 ac ab 6e 7b 30 19  |IM.~.1......n{0.|
+00000210  06 03 55 1d 11 04 12 30  10 82 0e 65 78 61 6d 70  |..U....0...examp|
+00000220  6c 65 2e 67 6f 6c 61 6e  67 30 0d 06 09 2a 86 48  |le.golang0...*.H|
+00000230  86 f7 0d 01 01 0b 05 00  03 81 81 00 9d 30 cc 40  |.............0.@|
+00000240  2b 5b 50 a0 61 cb ba e5  53 58 e1 ed 83 28 a9 58  |+[P.a...SX...(.X|
+00000250  1a a9 38 a4 95 a1 ac 31  5a 1a 84 66 3d 43 d3 2d  |..8....1Z..f=C.-|
+00000260  d9 0b f2 97 df d3 20 64  38 92 24 3a 00 bc cf 9c  |...... d8.$:....|
+00000270  7d b7 40 20 01 5f aa d3  16 61 09 a2 76 fd 13 c3  |}.@ ._...a..v...|
+00000280  cc e1 0c 5c ee b1 87 82  f1 6c 04 ed 73 bb b3 43  |...\.....l..s..C|
+00000290  77 8d 0c 1c f1 0f a1 d8  40 83 61 c9 4c 72 2b 9d  |w.......@.a.Lr+.|
+000002a0  ae db 46 06 06 4d f4 c1  b3 3e c0 d1 bd 42 d4 db  |..F..M...>...B..|
+000002b0  fe 3d 13 60 84 5c 21 d3  3b e9 fa e7 16 03 03 00  |.=.`.\!.;.......|
+000002c0  ac 0c 00 00 a8 03 00 1d  20 94 54 54 4c 52 a7 a5  |........ .TTLR..|
+000002d0  c0 01 ed 59 bf 46 03 59  25 3b 57 f8 24 99 1b dc  |...Y.F.Y%;W.$...|
+000002e0  f6 f4 1d 42 0e 2e c3 7c  02 08 04 00 80 5a 42 35  |...B...|.....ZB5|
+000002f0  78 c8 a9 37 6f 61 a4 ef  3a a3 12 03 f7 ee 44 be  |x..7oa..:.....D.|
+00000300  8b c9 52 4f de db f5 1e  9c c8 33 32 3c 0a 9e d6  |..RO......32<...|
+00000310  32 bf 2e 12 f7 b0 9b 15  dc eb 24 6e d6 f2 ad 5d  |2.........$n...]|
+00000320  9e 77 c4 a7 7a a1 a0 13  0b 90 b4 aa 3e 51 a1 3d  |.w..z.......>Q.=|
+00000330  71 09 15 84 1c c5 98 bb  12 db 11 e2 4c 2c d1 a9  |q...........L,..|
+00000340  5a ed 8e fb c6 ae ec d5  6d ec d8 d8 2a a7 23 ae  |Z.......m...*.#.|
+00000350  d7 d2 03 d0 23 8a 21 ac  7e 56 b4 23 7f c6 2a 72  |....#.!.~V.#..*r|
+00000360  85 0b 6d 6c 9d 6f ad ee  15 20 d9 2b b9 16 03 03  |..ml.o... .+....|
+00000370  00 3a 0d 00 00 36 03 01  02 40 00 2e 04 03 05 03  |.:...6...@......|
+00000380  06 03 08 07 08 08 08 09  08 0a 08 0b 08 04 08 05  |................|
+00000390  08 06 04 01 05 01 06 01  03 03 02 03 03 01 02 01  |................|
+000003a0  03 02 02 02 04 02 05 02  06 02 00 00 16 03 03 00  |................|
+000003b0  04 0e 00 00 00                                    |.....|
+>>> Flow 3 (client to server)
+00000000  16 03 03 01 fd 0b 00 01  f9 00 01 f6 00 01 f3 30  |...............0|
+00000010  82 01 ef 30 82 01 58 a0  03 02 01 02 02 10 5c 19  |...0..X.......\.|
+00000020  c1 89 65 83 55 6f dc 0b  c9 b9 93 9f e9 bc 30 0d  |..e.Uo........0.|
+00000030  06 09 2a 86 48 86 f7 0d  01 01 0b 05 00 30 12 31  |..*.H........0.1|
+00000040  10 30 0e 06 03 55 04 0a  13 07 41 63 6d 65 20 43  |.0...U....Acme C|
+00000050  6f 30 1e 17 0d 31 36 30  38 31 37 32 31 35 32 33  |o0...16081721523|
+00000060  31 5a 17 0d 31 37 30 38  31 37 32 31 35 32 33 31  |1Z..170817215231|
+00000070  5a 30 12 31 10 30 0e 06  03 55 04 0a 13 07 41 63  |Z0.1.0...U....Ac|
+00000080  6d 65 20 43 6f 30 81 9f  30 0d 06 09 2a 86 48 86  |me Co0..0...*.H.|
+00000090  f7 0d 01 01 01 05 00 03  81 8d 00 30 81 89 02 81  |...........0....|
+000000a0  81 00 ba 6f aa 86 bd cf  bf 9f f2 ef 5c 94 60 78  |...o........\.`x|
+000000b0  6f e8 13 f2 d1 96 6f cd  d9 32 6e 22 37 ce 41 f9  |o.....o..2n"7.A.|
+000000c0  ca 5d 29 ac e1 27 da 61  a2 ee 81 cb 10 c7 df 34  |.])..'.a.......4|
+000000d0  58 95 86 e9 3d 19 e6 5c  27 73 60 c8 8d 78 02 f4  |X...=..\'s`..x..|
+000000e0  1d a4 98 09 a3 19 70 69  3c 25 62 66 2a ab 22 23  |......pi<%bf*."#|
+000000f0  c5 7b 85 38 4f 2e 09 73  32 a7 bd 3e 9b ad ca 84  |.{.8O..s2..>....|
+00000100  07 e6 0f 3a ff 77 c5 9d  41 85 00 8a b6 9b ee b0  |...:.w..A.......|
+00000110  a4 3f 2d 4c 4c e6 42 3e  bb 51 c8 dd 48 54 f4 0c  |.?-LL.B>.Q..HT..|
+00000120  8e 47 02 03 01 00 01 a3  46 30 44 30 0e 06 03 55  |.G......F0D0...U|
+00000130  1d 0f 01 01 ff 04 04 03  02 05 a0 30 13 06 03 55  |...........0...U|
+00000140  1d 25 04 0c 30 0a 06 08  2b 06 01 05 05 07 03 01  |.%..0...+.......|
+00000150  30 0c 06 03 55 1d 13 01  01 ff 04 02 30 00 30 0f  |0...U.......0.0.|
+00000160  06 03 55 1d 11 04 08 30  06 87 04 7f 00 00 01 30  |..U....0.......0|
+00000170  0d 06 09 2a 86 48 86 f7  0d 01 01 0b 05 00 03 81  |...*.H..........|
+00000180  81 00 46 ab 44 a2 fb 28  54 f8 5a 67 f8 62 94 f1  |..F.D..(T.Zg.b..|
+00000190  9a b2 18 9e f2 b1 de 1d  7e 6f 76 95 a9 ba e7 5d  |........~ov....]|
+000001a0  a8 16 6c 9c f7 09 d3 37  e4 4b 2b 36 7c 01 ad 41  |..l....7.K+6|..A|
+000001b0  d2 32 d8 c3 d2 93 f9 10  6b 8e 95 b9 2c 17 8a a3  |.2......k...,...|
+000001c0  44 48 bc 59 13 83 16 04  88 a4 81 5c 25 0d 98 0c  |DH.Y.......\%...|
+000001d0  ac 11 b1 28 56 be 1d cd  61 62 84 09 bf d6 80 c6  |...(V...ab......|
+000001e0  45 8d 82 2c b4 d8 83 9b  db c9 22 b7 2a 12 11 7b  |E..,......".*..{|
+000001f0  fa 02 3b c1 c9 ff ea c9  9d a8 49 d3 95 d7 d5 0e  |..;.......I.....|
+00000200  e5 35 16 03 03 00 25 10  00 00 21 20 2f e5 7d a3  |.5....%...! /.}.|
+00000210  47 cd 62 43 15 28 da ac  5f bb 29 07 30 ff f6 84  |G.bC.(.._.).0...|
+00000220  af c4 cf c2 ed 90 99 5f  58 cb 3b 74 16 03 03 00  |......._X.;t....|
+00000230  88 0f 00 00 84 04 01 00  80 61 11 ba 1a fe 08 7c  |.........a.....||
+00000240  40 68 88 01 a4 3a 46 bf  f6 e9 bb b6 08 92 20 f0  |@h...:F....... .|
+00000250  13 90 c2 4b 53 83 a1 12  c2 d5 8d e6 67 82 df 80  |...KS.......g...|
+00000260  85 a5 b4 e0 cf 1b d6 3a  46 1e 62 e5 7f 21 bc 91  |.......:F.b..!..|
+00000270  4a 8c c0 79 16 64 5f 7e  40 c5 fb 7a 52 5b bf db  |J..y.d_~@..zR[..|
+00000280  cc 31 f8 b8 37 ef df dc  5f 96 30 ad dd 0b 8a 87  |.1..7..._.0.....|
+00000290  af 4d c6 5c a5 5e d7 2e  fa c7 72 68 85 71 c3 0e  |.M.\.^....rh.q..|
+000002a0  1b 26 87 ff 46 47 4a 1b  ce b7 a5 aa 13 d2 5a e3  |.&..FGJ.......Z.|
+000002b0  36 02 35 df 68 d9 bf 3f  24 14 03 03 00 01 01 16  |6.5.h..?$.......|
+000002c0  03 03 00 28 00 00 00 00  00 00 00 00 e3 8e cc e5  |...(............|
+000002d0  2e ab 40 fa 3d 47 c1 4f  3f de 97 a9 3d 96 73 ba  |..@.=G.O?...=.s.|
+000002e0  eb a0 ce 67 f6 d1 14 b8  7e cd 1f 85              |...g....~...|
+>>> Flow 4 (server to client)
+00000000  14 03 03 00 01 01 16 03  03 00 28 6a 0a 74 70 75  |..........(j.tpu|
+00000010  0b 39 33 a5 15 0d 7c 7f  f8 13 de 0e 0a 8f 13 3b  |.93...|........;|
+00000020  62 4f 8a 0b bd 0a aa 9b  5a 52 d5 e6 9f e5 b9 3f  |bO......ZR.....?|
+00000030  bd d8 3b                                          |..;|
+>>> Flow 5 (client to server)
+00000000  17 03 03 00 1e 00 00 00  00 00 00 00 01 0e 4d 62  |..............Mb|
+00000010  d3 ac cd 11 15 6d 24 c7  00 fa f9 d2 91 ba eb 06  |.....m$.........|
+00000020  f2 44 f1 15 03 03 00 1a  00 00 00 00 00 00 00 02  |.D..............|
+00000030  d1 5a 58 ba ae 65 15 67  79 1f 52 f1 1a da 50 99  |.ZX..e.gy.R...P.|
+00000040  e8 50                                             |.P|
diff --git a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled-512 b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled-512
new file mode 100644
index 0000000..0e04729
--- /dev/null
+++ b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled-512
@@ -0,0 +1,125 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 f8 01 00 00  f4 03 03 00 00 00 00 00  |................|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 00 00 00 00 00  00 00 00 20 00 00 00 00  |........... ....|
+00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 32 cc a8  |.............2..|
+00000050  cc a9 c0 2f c0 2b c0 30  c0 2c c0 27 c0 13 c0 23  |.../.+.0.,.'...#|
+00000060  c0 09 c0 14 c0 0a 00 9c  00 9d 00 3c 00 2f 00 35  |...........<./.5|
+00000070  c0 12 00 0a 00 05 c0 11  c0 07 13 01 13 03 13 02  |................|
+00000080  01 00 00 79 00 05 00 05  01 00 00 00 00 00 0a 00  |...y............|
+00000090  0a 00 08 00 1d 00 17 00  18 00 19 00 0b 00 02 01  |................|
+000000a0  00 00 0d 00 18 00 16 08  04 08 05 08 06 04 01 04  |................|
+000000b0  03 05 01 05 03 06 01 06  03 02 01 02 03 ff 01 00  |................|
+000000c0  01 00 00 12 00 00 00 2b  00 09 08 03 04 03 03 03  |.......+........|
+000000d0  02 03 01 00 33 00 26 00  24 00 1d 00 20 2f e5 7d  |....3.&.$... /.}|
+000000e0  a3 47 cd 62 43 15 28 da  ac 5f bb 29 07 30 ff f6  |.G.bC.(.._.).0..|
+000000f0  84 af c4 cf c2 ed 90 99  5f 58 cb 3b 74           |........_X.;t|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 59 02 00 00  55 03 03 68 11 23 f1 8d  |....Y...U..h.#..|
+00000010  2b a0 71 8f 6e ad 9f ae  43 58 c2 93 2e f5 01 3d  |+.q.n...CX.....=|
+00000020  15 b6 d6 0d f5 42 25 ca  b7 b4 96 20 00 c7 86 06  |.....B%.... ....|
+00000030  ed d1 23 99 dd e3 c4 f5  f9 31 42 51 a3 51 5a 40  |..#......1BQ.QZ@|
+00000040  11 f6 07 90 51 04 f8 a2  f6 66 c1 f7 c0 2f 00 00  |....Q....f.../..|
+00000050  0d ff 01 00 01 00 00 0b  00 04 03 00 01 02 16 03  |................|
+00000060  03 02 59 0b 00 02 55 00  02 52 00 02 4f 30 82 02  |..Y...U..R..O0..|
+00000070  4b 30 82 01 b4 a0 03 02  01 02 02 09 00 e8 f0 9d  |K0..............|
+00000080  3f e2 5b ea a6 30 0d 06  09 2a 86 48 86 f7 0d 01  |?.[..0...*.H....|
+00000090  01 0b 05 00 30 1f 31 0b  30 09 06 03 55 04 0a 13  |....0.1.0...U...|
+000000a0  02 47 6f 31 10 30 0e 06  03 55 04 03 13 07 47 6f  |.Go1.0...U....Go|
+000000b0  20 52 6f 6f 74 30 1e 17  0d 31 36 30 31 30 31 30  | Root0...1601010|
+000000c0  30 30 30 30 30 5a 17 0d  32 35 30 31 30 31 30 30  |00000Z..25010100|
+000000d0  30 30 30 30 5a 30 1a 31  0b 30 09 06 03 55 04 0a  |0000Z0.1.0...U..|
+000000e0  13 02 47 6f 31 0b 30 09  06 03 55 04 03 13 02 47  |..Go1.0...U....G|
+000000f0  6f 30 81 9f 30 0d 06 09  2a 86 48 86 f7 0d 01 01  |o0..0...*.H.....|
+00000100  01 05 00 03 81 8d 00 30  81 89 02 81 81 00 db 46  |.......0.......F|
+00000110  7d 93 2e 12 27 06 48 bc  06 28 21 ab 7e c4 b6 a2  |}...'.H..(!.~...|
+00000120  5d fe 1e 52 45 88 7a 36  47 a5 08 0d 92 42 5b c2  |]..RE.z6G....B[.|
+00000130  81 c0 be 97 79 98 40 fb  4f 6d 14 fd 2b 13 8b c2  |....y.@.Om..+...|
+00000140  a5 2e 67 d8 d4 09 9e d6  22 38 b7 4a 0b 74 73 2b  |..g....."8.J.ts+|
+00000150  c2 34 f1 d1 93 e5 96 d9  74 7b f3 58 9f 6c 61 3c  |.4......t{.X.la<|
+00000160  c0 b0 41 d4 d9 2b 2b 24  23 77 5b 1c 3b bd 75 5d  |..A..++$#w[.;.u]|
+00000170  ce 20 54 cf a1 63 87 1d  1e 24 c4 f3 1d 1a 50 8b  |. T..c...$....P.|
+00000180  aa b6 14 43 ed 97 a7 75  62 f4 14 c8 52 d7 02 03  |...C...ub...R...|
+00000190  01 00 01 a3 81 93 30 81  90 30 0e 06 03 55 1d 0f  |......0..0...U..|
+000001a0  01 01 ff 04 04 03 02 05  a0 30 1d 06 03 55 1d 25  |.........0...U.%|
+000001b0  04 16 30 14 06 08 2b 06  01 05 05 07 03 01 06 08  |..0...+.........|
+000001c0  2b 06 01 05 05 07 03 02  30 0c 06 03 55 1d 13 01  |+.......0...U...|
+000001d0  01 ff 04 02 30 00 30 19  06 03 55 1d 0e 04 12 04  |....0.0...U.....|
+000001e0  10 9f 91 16 1f 43 43 3e  49 a6 de 6d b6 80 d7 9f  |.....CC>I..m....|
+000001f0  60 30 1b 06 03 55 1d 23  04 14 30 12 80 10 48 13  |`0...U.#..0...H.|
+00000200  49 4d 13 7e 16 31 bb a3  01 d5 ac ab 6e 7b 30 19  |IM.~.1......n{0.|
+00000210  06 03 55 1d 11 04 12 30  10 82 0e 65 78 61 6d 70  |..U....0...examp|
+00000220  6c 65 2e 67 6f 6c 61 6e  67 30 0d 06 09 2a 86 48  |le.golang0...*.H|
+00000230  86 f7 0d 01 01 0b 05 00  03 81 81 00 9d 30 cc 40  |.............0.@|
+00000240  2b 5b 50 a0 61 cb ba e5  53 58 e1 ed 83 28 a9 58  |+[P.a...SX...(.X|
+00000250  1a a9 38 a4 95 a1 ac 31  5a 1a 84 66 3d 43 d3 2d  |..8....1Z..f=C.-|
+00000260  d9 0b f2 97 df d3 20 64  38 92 24 3a 00 bc cf 9c  |...... d8.$:....|
+00000270  7d b7 40 20 01 5f aa d3  16 61 09 a2 76 fd 13 c3  |}.@ ._...a..v...|
+00000280  cc e1 0c 5c ee b1 87 82  f1 6c 04 ed 73 bb b3 43  |...\.....l..s..C|
+00000290  77 8d 0c 1c f1 0f a1 d8  40 83 61 c9 4c 72 2b 9d  |w.......@.a.Lr+.|
+000002a0  ae db 46 06 06 4d f4 c1  b3 3e c0 d1 bd 42 d4 db  |..F..M...>...B..|
+000002b0  fe 3d 13 60 84 5c 21 d3  3b e9 fa e7 16 03 03 00  |.=.`.\!.;.......|
+000002c0  ac 0c 00 00 a8 03 00 1d  20 fe 68 1c bf 2b d7 75  |........ .h..+.u|
+000002d0  c2 dd 96 03 5d 77 61 c1  7d dd 6f bc ea 3c aa 27  |....]wa.}.o..<.'|
+000002e0  ba cf 93 e2 8b d8 66 a1  1c 08 04 00 80 5e 16 b9  |......f......^..|
+000002f0  53 17 7d 8d bb 46 4b 1f  37 be cd fe e1 45 c3 10  |S.}..FK.7....E..|
+00000300  68 54 e4 61 20 a5 a5 98  4b df a7 5d 41 4a aa f8  |hT.a ...K..]AJ..|
+00000310  0e 36 c2 02 a6 56 a9 f1  aa 76 86 fd a7 86 fb 06  |.6...V...v......|
+00000320  94 55 56 bd eb 57 10 9a  d5 ba 70 59 46 75 e3 b3  |.UV..W....pYFu..|
+00000330  29 14 c2 65 0e 5c a1 47  e6 bf 12 9d 31 8f 65 4d  |)..e.\.G....1.eM|
+00000340  af dc 1b 6e d2 de d7 fb  85 e7 5a 42 4f de bf d8  |...n......ZBO...|
+00000350  d5 d8 5c 95 71 27 e7 04  af 58 0a d8 77 fb 3d 22  |..\.q'...X..w.="|
+00000360  84 f6 f6 53 c0 79 7a 72  01 6e 5c e1 a8 16 03 03  |...S.yzr.n\.....|
+00000370  00 3a 0d 00 00 36 03 01  02 40 00 2e 04 03 05 03  |.:...6...@......|
+00000380  06 03 08 07 08 08 08 09  08 0a 08 0b 08 04 08 05  |................|
+00000390  08 06 04 01 05 01 06 01  03 03 02 03 03 01 02 01  |................|
+000003a0  03 02 02 02 04 02 05 02  06 02 00 00 16 03 03 00  |................|
+000003b0  04 0e 00 00 00                                    |.....|
+>>> Flow 3 (client to server)
+00000000  16 03 03 01 7f 0b 00 01  7b 00 01 78 00 01 75 30  |........{..x..u0|
+00000010  82 01 71 30 82 01 1b a0  03 02 01 02 02 10 1a 34  |..q0...........4|
+00000020  27 90 21 65 52 a6 85 96  de a2 c7 2c ff b4 30 0d  |'.!eR......,..0.|
+00000030  06 09 2a 86 48 86 f7 0d  01 01 0b 05 00 30 12 31  |..*.H........0.1|
+00000040  10 30 0e 06 03 55 04 0a  13 07 41 63 6d 65 20 43  |.0...U....Acme C|
+00000050  6f 30 1e 17 0d 31 39 30  31 31 38 32 33 32 33 32  |o0...19011823232|
+00000060  38 5a 17 0d 32 30 30 31  31 38 32 33 32 33 32 38  |8Z..200118232328|
+00000070  5a 30 12 31 10 30 0e 06  03 55 04 0a 13 07 41 63  |Z0.1.0...U....Ac|
+00000080  6d 65 20 43 6f 30 5c 30  0d 06 09 2a 86 48 86 f7  |me Co0\0...*.H..|
+00000090  0d 01 01 01 05 00 03 4b  00 30 48 02 41 00 dd 7b  |.......K.0H.A..{|
+000000a0  3d 6b 15 40 f0 6b 1d 87  4f 16 dc 9c 55 0f f4 08  |=k.@.k..O...U...|
+000000b0  5c 80 41 8c 1d 55 76 9e  7e 15 54 45 85 24 1e 88  |\.A..Uv.~.TE.$..|
+000000c0  f0 2f cd 93 1d 17 cb 24  25 ae 61 58 07 31 10 9c  |./.....$%.aX.1..|
+000000d0  83 e1 2a 5b 38 4f 48 45  a0 bb e3 26 75 e9 02 03  |..*[8OHE...&u...|
+000000e0  01 00 01 a3 4d 30 4b 30  0e 06 03 55 1d 0f 01 01  |....M0K0...U....|
+000000f0  ff 04 04 03 02 05 a0 30  13 06 03 55 1d 25 04 0c  |.......0...U.%..|
+00000100  30 0a 06 08 2b 06 01 05  05 07 03 01 30 0c 06 03  |0...+.......0...|
+00000110  55 1d 13 01 01 ff 04 02  30 00 30 16 06 03 55 1d  |U.......0.0...U.|
+00000120  11 04 0f 30 0d 82 0b 65  78 61 6d 70 6c 65 2e 63  |...0...example.c|
+00000130  6f 6d 30 0d 06 09 2a 86  48 86 f7 0d 01 01 0b 05  |om0...*.H.......|
+00000140  00 03 41 00 c4 3b 94 4b  e0 6b ad 2d dc fa 1f a4  |..A..;.K.k.-....|
+00000150  f9 f4 0f 3a 63 92 73 2e  b2 4d 7f 66 1f 0d 10 29  |...:c.s..M.f...)|
+00000160  bb 9c 19 a9 97 60 4c b4  51 12 30 39 d3 b4 b5 0d  |.....`L.Q.09....|
+00000170  cb 1c f7 35 60 6b d8 48  fc 24 0e 39 23 a8 40 ac  |...5`k.H.$.9#.@.|
+00000180  d9 59 bf 00 16 03 03 00  25 10 00 00 21 20 2f e5  |.Y......%...! /.|
+00000190  7d a3 47 cd 62 43 15 28  da ac 5f bb 29 07 30 ff  |}.G.bC.(.._.).0.|
+000001a0  f6 84 af c4 cf c2 ed 90  99 5f 58 cb 3b 74 16 03  |........._X.;t..|
+000001b0  03 00 48 0f 00 00 44 04  01 00 40 15 33 b2 27 d6  |..H...D...@.3.'.|
+000001c0  ad 7f 45 86 df a0 83 5e  7c fb a7 0e 04 8e 3c a1  |..E....^|.....<.|
+000001d0  5b 9a 8f 98 04 cf 66 bb  cf 6a d4 63 d7 ff b2 a4  |[.....f..j.c....|
+000001e0  f1 08 27 f7 53 1c ec 76  35 b1 09 93 91 db 63 e3  |..'.S..v5.....c.|
+000001f0  a6 2b e5 55 da 06 5b 2f  c7 8d c3 14 03 03 00 01  |.+.U..[/........|
+00000200  01 16 03 03 00 28 00 00  00 00 00 00 00 00 98 d8  |.....(..........|
+00000210  99 fa 5a fb 79 57 1f 02  4e 07 51 d6 c6 32 9c e8  |..Z.yW..N.Q..2..|
+00000220  54 50 6c f9 63 fb 38 e2  ef 88 4b 7e 8d 7a        |TPl.c.8...K~.z|
+>>> Flow 4 (server to client)
+00000000  14 03 03 00 01 01 16 03  03 00 28 4c 6b f0 26 84  |..........(Lk.&.|
+00000010  97 e6 54 cf 1f 25 1c 91  5d 10 63 22 66 73 d2 ce  |..T..%..].c"fs..|
+00000020  0d 7c 0b 3d 7d 31 3c 0b  6c be 30 72 9e 04 c0 fb  |.|.=}1<.l.0r....|
+00000030  73 88 75                                          |s.u|
+>>> Flow 5 (client to server)
+00000000  17 03 03 00 1e 00 00 00  00 00 00 00 01 2a b2 2d  |.............*.-|
+00000010  7f 6e 12 2d d7 63 05 e8  c4 fd 81 de b6 65 2f 2b  |.n.-.c.......e/+|
+00000020  00 0e 13 15 03 03 00 1a  00 00 00 00 00 00 00 02  |................|
+00000030  9c c0 ae 5a b4 5f b5 4f  cd 3f 27 78 f9 b3 b5 b5  |...Z._.O.?'x....|
+00000040  57 f2                                             |W.|
diff --git a/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled b/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled
new file mode 100644
index 0000000..98d718b
--- /dev/null
+++ b/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled
@@ -0,0 +1,138 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 f8 01 00 00  f4 03 03 00 00 00 00 00  |................|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 00 00 00 00 00  00 00 00 20 00 00 00 00  |........... ....|
+00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 32 cc a8  |.............2..|
+00000050  cc a9 c0 2f c0 2b c0 30  c0 2c c0 27 c0 13 c0 23  |.../.+.0.,.'...#|
+00000060  c0 09 c0 14 c0 0a 00 9c  00 9d 00 3c 00 2f 00 35  |...........<./.5|
+00000070  c0 12 00 0a 00 05 c0 11  c0 07 13 01 13 03 13 02  |................|
+00000080  01 00 00 79 00 05 00 05  01 00 00 00 00 00 0a 00  |...y............|
+00000090  0a 00 08 00 1d 00 17 00  18 00 19 00 0b 00 02 01  |................|
+000000a0  00 00 0d 00 18 00 16 08  04 08 05 08 06 04 01 04  |................|
+000000b0  03 05 01 05 03 06 01 06  03 02 01 02 03 ff 01 00  |................|
+000000c0  01 00 00 12 00 00 00 2b  00 09 08 03 04 03 03 03  |.......+........|
+000000d0  02 03 01 00 33 00 26 00  24 00 1d 00 20 2f e5 7d  |....3.&.$... /.}|
+000000e0  a3 47 cd 62 43 15 28 da  ac 5f bb 29 07 30 ff f6  |.G.bC.(.._.).0..|
+000000f0  84 af c4 cf c2 ed 90 99  5f 58 cb 3b 74           |........_X.;t|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 7a 02 00 00  76 03 03 e5 55 1c 7e bc  |....z...v...U.~.|
+00000010  05 a3 af 8b 02 03 6a 08  34 35 43 9f 35 c1 39 36  |......j.45C.5.96|
+00000020  97 ab d9 4f 77 26 88 31  f8 1c a4 20 00 00 00 00  |...Ow&.1... ....|
+00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000040  00 00 00 00 00 00 00 00  00 00 00 00 13 01 00 00  |................|
+00000050  2e 00 2b 00 02 03 04 00  33 00 24 00 1d 00 20 63  |..+.....3.$... c|
+00000060  74 2f 45 26 f4 7c cd d6  cb 8d 9f b5 6b 88 41 ef  |t/E&.|......k.A.|
+00000070  f4 cd 00 54 91 29 98 e4  a0 6b 6d b5 2f 39 01 14  |...T.)...km./9..|
+00000080  03 03 00 01 01 17 03 03  00 17 e6 81 13 75 85 fe  |.............u..|
+00000090  7d c6 09 24 01 bf 44 78  65 4e 5f d0 37 b9 89 15  |}..$..DxeN_.7...|
+000000a0  98 17 03 03 00 42 88 5c  b3 19 ee 62 c0 2d 95 51  |.....B.\...b.-.Q|
+000000b0  fd 88 e0 13 aa 53 e5 5a  45 be 0f 07 6f 46 c8 1b  |.....S.ZE...oF..|
+000000c0  a2 b5 2a 7c 46 5f b5 90  46 95 b9 a4 ce 44 a8 a7  |..*|F_..F....D..|
+000000d0  3d 8e ce d2 76 57 44 e0  0e 83 af f3 2f 00 55 cb  |=...vWD...../.U.|
+000000e0  1f e7 d2 42 22 6f 78 0c  17 03 03 02 6d 45 f7 95  |...B"ox.....mE..|
+000000f0  68 b9 ad 32 13 34 84 c2  dd 62 a7 f5 18 0f 0b a6  |h..2.4...b......|
+00000100  b8 5c dd 06 69 0d 07 ea  6b ec ad ad a7 13 ea f3  |.\..i...k.......|
+00000110  87 9b 74 a9 53 49 b3 a9  ff f3 eb 71 1b 25 63 8b  |..t.SI.....q.%c.|
+00000120  c6 0f 6a 21 bc f1 fb 4b  8e d4 07 6e c6 8e 9f bf  |..j!...K...n....|
+00000130  73 eb 1e a5 d7 e4 a1 cd  6e 7e de 45 a2 b4 6f 25  |s.......n~.E..o%|
+00000140  fe c2 a1 84 b8 09 d1 65  90 6d ef 07 ea d0 25 01  |.......e.m....%.|
+00000150  54 f2 8e f8 53 38 1e 35  a9 af be 2a 8d 81 9b 77  |T...S8.5...*...w|
+00000160  38 22 42 b8 56 ea 72 ab  c3 ac 9b 17 1a 0b 65 94  |8"B.V.r.......e.|
+00000170  8a 81 6d 83 c6 f4 76 32  ed f7 84 4d ec 17 0e 45  |..m...v2...M...E|
+00000180  74 e8 ba b0 46 92 62 8c  73 07 a8 1f d5 d3 44 d1  |t...F.b.s.....D.|
+00000190  53 21 62 8b 02 c6 20 40  1d f1 75 2b 8a 6a 60 2a  |S!b... @..u+.j`*|
+000001a0  ee 04 5f c0 46 6d 74 7a  18 4a e0 ca d4 a6 6a a2  |.._.Fmtz.J....j.|
+000001b0  11 21 20 4a 3e 57 3c 67  ff 61 3d 15 32 14 f2 01  |.! J>W<g.a=.2...|
+000001c0  a2 cc 96 f6 d1 2d 4f ba  67 ed 02 ae a9 08 13 74  |.....-O.g......t|
+000001d0  33 f6 b5 ad e3 e3 ee 0e  65 f6 89 db 80 d4 f5 23  |3.......e......#|
+000001e0  7b 5d 7a af 5f c6 43 b7  87 f6 90 25 5a f0 f6 76  |{]z._.C....%Z..v|
+000001f0  63 9c 93 d0 f3 94 9c 55  f7 e7 8f 2d cb 83 fb a1  |c......U...-....|
+00000200  b3 db 11 d7 f9 f7 4b 66  50 55 64 31 3f fc 97 df  |......KfPUd1?...|
+00000210  65 f9 e0 eb a2 5e 4d 9d  c7 35 fb 1c 22 79 b1 00  |e....^M..5.."y..|
+00000220  28 e9 54 28 a9 e6 97 e8  33 92 ac 8e f7 c0 82 ac  |(.T(....3.......|
+00000230  99 04 f0 f0 cc e7 4f 04  ad fe dc 9f 25 82 93 12  |......O.....%...|
+00000240  64 4a f6 34 da 41 8a f7  a9 3e fe 24 ae be 40 b7  |dJ.4.A...>.$..@.|
+00000250  10 59 17 11 6f 3c 11 8b  eb b2 42 e7 d5 b7 ee d2  |.Y..o<....B.....|
+00000260  ae 95 9c 21 48 34 d9 5a  20 95 7c 72 35 05 5e 6c  |...!H4.Z .|r5.^l|
+00000270  a2 05 46 30 e6 33 d3 91  ac c8 17 4b b1 15 cc f0  |..F0.3.....K....|
+00000280  af bb 7c 56 e0 5b 25 8e  35 e0 2e 35 91 0d e0 bc  |..|V.[%.5..5....|
+00000290  f6 9c 3b 15 f8 96 dc 4e  6c aa 57 c9 f0 1f 55 e2  |..;....Nl.W...U.|
+000002a0  d9 5d 09 71 f9 af 17 69  29 d5 94 8a 5f fa b2 ad  |.].q...i)..._...|
+000002b0  1b b9 ce 90 e7 bd 02 1b  ad 9d 91 19 7e f3 8f 2d  |............~..-|
+000002c0  70 d5 af 2c e7 29 b1 f9  3c 5a 7f 04 6f 73 88 da  |p..,.)..<Z..os..|
+000002d0  84 bd d7 ad 01 dd 35 b7  1f 64 79 89 ab cb 21 d1  |......5..dy...!.|
+000002e0  20 c5 71 b7 78 fe 93 c0  41 33 d8 aa a2 ed a4 64  | .q.x...A3.....d|
+000002f0  fb 5b c1 6e 0d 1e f7 ca  f6 01 a1 9a fc 82 af 34  |.[.n...........4|
+00000300  e3 45 d8 5a b9 81 e7 e4  c2 26 a7 79 b7 f4 87 9f  |.E.Z.....&.y....|
+00000310  2e 16 ab 96 21 e2 5f 1f  c9 e0 30 3e 97 27 42 15  |....!._...0>.'B.|
+00000320  6f 13 da a1 b2 b1 43 76  69 eb f1 c6 e2 b5 6c 57  |o.....Cvi.....lW|
+00000330  e0 88 c9 0d 7d 37 1b 0b  a0 b7 cd 6b ba 3a 52 55  |....}7.....k.:RU|
+00000340  61 c6 5c 71 ce 1e 69 b9  ea b4 c6 a5 78 c5 b8 b6  |a.\q..i.....x...|
+00000350  4e b1 94 84 a3 d4 31 d9  3b 15 17 03 03 00 99 6c  |N.....1.;......l|
+00000360  5d dd 43 24 9d 6e 5d 64  d3 54 30 aa 98 c3 7e 21  |].C$.n]d.T0...~!|
+00000370  05 06 fc 3b eb 52 12 36  6b 2e e1 32 5a 59 30 a7  |...;.R.6k..2ZY0.|
+00000380  b0 bb 52 1a 36 e6 78 20  84 8c cf 0d 90 da c7 88  |..R.6.x ........|
+00000390  c4 2f bc b4 b6 03 1b 34  9b c8 12 db bc 87 95 d3  |./.....4........|
+000003a0  84 4e 41 c1 de 2f 4c 66  d9 13 fc 78 31 05 6c 67  |.NA../Lf...x1.lg|
+000003b0  e3 3d 28 36 0f fe 5f 45  29 d2 1b 4d a5 60 dc f7  |.=(6.._E)..M.`..|
+000003c0  20 74 cf f5 7b 3f f7 58  53 0c 64 7d 3f c6 f1 ac  | t..{?.XS.d}?...|
+000003d0  a9 1b 60 d8 ea a5 32 11  23 6d 66 19 70 2b fa ce  |..`...2.#mf.p+..|
+000003e0  c8 f6 9d cc 12 83 a1 e1  4b be 98 d3 c2 56 65 34  |........K....Ve4|
+000003f0  73 3a b3 6e d8 2c db 3b  17 03 03 00 35 e6 ce 17  |s:.n.,.;....5...|
+00000400  e5 92 38 9e 00 2d 66 bf  a9 e2 13 66 01 af 64 15  |..8..-f....f..d.|
+00000410  8d da 6b f3 a7 f6 5c 76  e1 f4 c4 2f dc 93 c4 3c  |..k...\v.../...<|
+00000420  69 5a 30 e5 db 5a b5 0b  98 4e 43 a3 51 ba 41 9d  |iZ0..Z...NC.Q.A.|
+00000430  18 c0                                             |..|
+>>> Flow 3 (client to server)
+00000000  14 03 03 00 01 01 17 03  03 02 11 24 0f 0c cc 6a  |...........$...j|
+00000010  8e 07 9c d7 f9 84 55 cc  79 a7 c1 c5 fb 6e 29 5e  |......U.y....n)^|
+00000020  31 e1 b1 00 c0 c9 a8 94  59 75 f4 b5 86 7c a4 8c  |1.......Yu...|..|
+00000030  8d 79 dd 42 45 67 69 f5  fb f0 02 54 f5 8f 1a 86  |.y.BEgi....T....|
+00000040  2f a0 4e 9b 68 e2 69 36  48 cb 8e cc 26 fa 1b 60  |/.N.h.i6H...&..`|
+00000050  c8 f3 b7 7c 36 dd 59 71  a3 f8 9a 7a bc 8a e1 10  |...|6.Yq...z....|
+00000060  8f 6d 69 60 07 b6 62 6d  d3 2b fa a4 81 eb ae 3f  |.mi`..bm.+.....?|
+00000070  9d 7e 1d d7 d1 89 24 4e  7e 65 4b d2 37 58 b2 56  |.~....$N~eK.7X.V|
+00000080  a1 8e 10 73 44 9c f1 c7  60 97 49 99 e2 82 74 58  |...sD...`.I...tX|
+00000090  e3 1f 41 ec 1d 13 85 f1  95 98 39 cb d1 51 f7 0e  |..A.......9..Q..|
+000000a0  fe e4 fa 04 20 1a f2 c5  ae 64 9d eb f8 ff 03 ce  |.... ....d......|
+000000b0  ca 12 7c dd a6 b4 2c a3  eb 8e 83 2c cf 77 6b 82  |..|...,....,.wk.|
+000000c0  68 77 58 5d 3e ef 01 0b  78 e9 37 b0 36 9c 62 44  |hwX]>...x.7.6.bD|
+000000d0  88 ae f1 5a d7 93 81 0a  84 cf 4f 3b db 05 41 92  |...Z......O;..A.|
+000000e0  4d 31 3d 06 9e 73 11 43  de 3e ec b8 b0 48 99 84  |M1=..s.C.>...H..|
+000000f0  bc 0c 7c 86 93 03 d5 5f  c5 21 34 a5 cc c7 d5 42  |..|...._.!4....B|
+00000100  1d 69 94 53 39 d9 56 07  40 46 44 89 e6 95 8d e9  |.i.S9.V.@FD.....|
+00000110  ca 6d f0 e0 2a 22 70 bc  e7 7f 8e 15 0c 56 51 e3  |.m..*"p......VQ.|
+00000120  46 5c b9 66 c5 8b 07 d3  f0 bb 84 fe 71 d6 a2 90  |F\.f........q...|
+00000130  d9 ec 46 00 82 10 38 9c  8f 35 e5 48 d8 82 7f 65  |..F...8..5.H...e|
+00000140  68 f5 42 48 74 6b 29 79  f3 32 b6 a1 aa 42 73 e3  |h.BHtk)y.2...Bs.|
+00000150  c3 f6 fc 76 9e 32 59 26  a6 75 4a dc 65 23 73 10  |...v.2Y&.uJ.e#s.|
+00000160  35 79 a5 41 7b 72 d5 cd  33 1f 7d 98 b3 39 4b f6  |5y.A{r..3.}..9K.|
+00000170  e8 09 ed d6 62 a0 48 b5  76 47 2e 7e 1a 5d 75 6d  |....b.H.vG.~.]um|
+00000180  c2 98 22 17 b1 8f 2e a5  a2 b3 b3 5e d9 89 c5 a0  |.."........^....|
+00000190  46 2a ac af 20 66 e9 f3  02 84 26 51 c0 0a 2e 0c  |F*.. f....&Q....|
+000001a0  d3 90 3c 9f 19 3f 25 3e  7d 3a 38 6f f3 ce 2f c4  |..<..?%>}:8o../.|
+000001b0  7b 84 e4 d5 c2 c8 90 54  6d 2c 59 70 34 44 53 25  |{......Tm,Yp4DS%|
+000001c0  ee ee d6 7e 13 30 1e 09  ff f2 79 bd 7c a1 af a9  |...~.0....y.|...|
+000001d0  a9 7b 51 6a d8 17 41 22  f5 d0 5d 84 00 a7 5f 1a  |.{Qj..A"..]..._.|
+000001e0  b6 15 98 de f4 bd cd fe  70 38 5c 0f 44 60 5a 7d  |........p8\.D`Z}|
+000001f0  be df 6e 56 bb 83 0b 10  fa 5d 3a 2c 9e 4a 00 7f  |..nV.....]:,.J..|
+00000200  ec f4 42 52 52 95 5e e1  bd cc cf a0 45 c2 79 2c  |..BRR.^.....E.y,|
+00000210  10 4d 14 35 ad bd 18 d4  b1 aa 09 65 17 03 03 00  |.M.5.......e....|
+00000220  99 a4 2c 7a c2 25 ba 3b  a2 84 1f e8 a0 d1 5c c4  |..,z.%.;......\.|
+00000230  bb c6 f8 fc eb 19 3e f5  e6 53 9f c3 35 d3 7a 00  |......>..S..5.z.|
+00000240  68 e1 e0 2f 73 75 d7 2d  df 44 aa 34 43 bf 66 c1  |h../su.-.D.4C.f.|
+00000250  31 0d e6 86 f8 71 6b 71  ac 89 c5 26 cf d9 1e 43  |1....qkq...&...C|
+00000260  33 c3 48 68 e0 4d f5 d5  69 ff fc 02 47 cc 91 41  |3.Hh.M..i...G..A|
+00000270  83 41 58 04 2a 02 53 3c  3b 0a 4c 18 16 00 fd e8  |.AX.*.S<;.L.....|
+00000280  64 54 0d 34 a1 3d a5 4b  bd c2 54 17 c3 5a 82 7a  |dT.4.=.K..T..Z.z|
+00000290  55 5d a9 57 63 62 ef 8b  3a 75 f2 cd 34 ef d6 30  |U].Wcb..:u..4..0|
+000002a0  08 7f 03 0b c3 eb 29 94  88 11 38 42 40 6f bf cc  |......)...8B@o..|
+000002b0  d4 01 3f 8a 90 11 f9 da  fd 9e 17 03 03 00 35 7d  |..?...........5}|
+000002c0  2d 12 d7 58 d0 76 43 25  d1 8d 5c 5c b1 7f fa 48  |-..X.vC%..\\...H|
+000002d0  a9 21 48 02 64 76 91 6c  79 7e b9 22 33 f7 32 cb  |.!H.dv.ly~."3.2.|
+000002e0  50 22 78 02 96 4e 2d f6  09 68 06 8e 44 e6 fd 7f  |P"x..N-..h..D...|
+000002f0  cf 0a 7e a3 17 03 03 00  17 84 cd d8 f2 e2 38 2e  |..~...........8.|
+00000300  57 e5 47 76 48 50 34 9e  65 d4 c6 1d 7d b3 4e 91  |W.GvHP4.e...}.N.|
+00000310  17 03 03 00 13 e5 05 98  5b 87 5d db ae 89 38 2c  |........[.]...8,|
+00000320  35 89 31 14 73 cd 16 54                           |5.1.s..T|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled
new file mode 100644
index 0000000..cb626a1
--- /dev/null
+++ b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled
@@ -0,0 +1,126 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 97 01 00 00  93 03 03 9e b1 2a 26 04  |.............*&.|
+00000010  8d 66 df 43 cb 0a 85 80  4f f2 99 7d 80 20 64 7e  |.f.C....O..}. d~|
+00000020  30 a0 bb 60 ac 0e d4 ce  f0 ae 98 00 00 04 00 2f  |0..`.........../|
+00000030  00 ff 01 00 00 66 00 00  00 0e 00 0c 00 00 09 31  |.....f.........1|
+00000040  32 37 2e 30 2e 30 2e 31  00 0b 00 04 03 00 01 02  |27.0.0.1........|
+00000050  00 0a 00 0c 00 0a 00 1d  00 17 00 1e 00 19 00 18  |................|
+00000060  00 16 00 00 00 17 00 00  00 0d 00 30 00 2e 04 03  |...........0....|
+00000070  05 03 06 03 08 07 08 08  08 09 08 0a 08 0b 08 04  |................|
+00000080  08 05 08 06 04 01 05 01  06 01 03 03 02 03 03 01  |................|
+00000090  02 01 03 02 02 02 04 02  05 02 06 02              |............|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 31 02 00 00  2d 03 03 00 00 00 00 00  |....1...-.......|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 44 4f 57 4e 47  52 44 01 00 00 2f 00 00  |...DOWNGRD.../..|
+00000030  05 ff 01 00 01 00 16 03  03 02 59 0b 00 02 55 00  |..........Y...U.|
+00000040  02 52 00 02 4f 30 82 02  4b 30 82 01 b4 a0 03 02  |.R..O0..K0......|
+00000050  01 02 02 09 00 e8 f0 9d  3f e2 5b ea a6 30 0d 06  |........?.[..0..|
+00000060  09 2a 86 48 86 f7 0d 01  01 0b 05 00 30 1f 31 0b  |.*.H........0.1.|
+00000070  30 09 06 03 55 04 0a 13  02 47 6f 31 10 30 0e 06  |0...U....Go1.0..|
+00000080  03 55 04 03 13 07 47 6f  20 52 6f 6f 74 30 1e 17  |.U....Go Root0..|
+00000090  0d 31 36 30 31 30 31 30  30 30 30 30 30 5a 17 0d  |.160101000000Z..|
+000000a0  32 35 30 31 30 31 30 30  30 30 30 30 5a 30 1a 31  |250101000000Z0.1|
+000000b0  0b 30 09 06 03 55 04 0a  13 02 47 6f 31 0b 30 09  |.0...U....Go1.0.|
+000000c0  06 03 55 04 03 13 02 47  6f 30 81 9f 30 0d 06 09  |..U....Go0..0...|
+000000d0  2a 86 48 86 f7 0d 01 01  01 05 00 03 81 8d 00 30  |*.H............0|
+000000e0  81 89 02 81 81 00 db 46  7d 93 2e 12 27 06 48 bc  |.......F}...'.H.|
+000000f0  06 28 21 ab 7e c4 b6 a2  5d fe 1e 52 45 88 7a 36  |.(!.~...]..RE.z6|
+00000100  47 a5 08 0d 92 42 5b c2  81 c0 be 97 79 98 40 fb  |G....B[.....y.@.|
+00000110  4f 6d 14 fd 2b 13 8b c2  a5 2e 67 d8 d4 09 9e d6  |Om..+.....g.....|
+00000120  22 38 b7 4a 0b 74 73 2b  c2 34 f1 d1 93 e5 96 d9  |"8.J.ts+.4......|
+00000130  74 7b f3 58 9f 6c 61 3c  c0 b0 41 d4 d9 2b 2b 24  |t{.X.la<..A..++$|
+00000140  23 77 5b 1c 3b bd 75 5d  ce 20 54 cf a1 63 87 1d  |#w[.;.u]. T..c..|
+00000150  1e 24 c4 f3 1d 1a 50 8b  aa b6 14 43 ed 97 a7 75  |.$....P....C...u|
+00000160  62 f4 14 c8 52 d7 02 03  01 00 01 a3 81 93 30 81  |b...R.........0.|
+00000170  90 30 0e 06 03 55 1d 0f  01 01 ff 04 04 03 02 05  |.0...U..........|
+00000180  a0 30 1d 06 03 55 1d 25  04 16 30 14 06 08 2b 06  |.0...U.%..0...+.|
+00000190  01 05 05 07 03 01 06 08  2b 06 01 05 05 07 03 02  |........+.......|
+000001a0  30 0c 06 03 55 1d 13 01  01 ff 04 02 30 00 30 19  |0...U.......0.0.|
+000001b0  06 03 55 1d 0e 04 12 04  10 9f 91 16 1f 43 43 3e  |..U..........CC>|
+000001c0  49 a6 de 6d b6 80 d7 9f  60 30 1b 06 03 55 1d 23  |I..m....`0...U.#|
+000001d0  04 14 30 12 80 10 48 13  49 4d 13 7e 16 31 bb a3  |..0...H.IM.~.1..|
+000001e0  01 d5 ac ab 6e 7b 30 19  06 03 55 1d 11 04 12 30  |....n{0...U....0|
+000001f0  10 82 0e 65 78 61 6d 70  6c 65 2e 67 6f 6c 61 6e  |...example.golan|
+00000200  67 30 0d 06 09 2a 86 48  86 f7 0d 01 01 0b 05 00  |g0...*.H........|
+00000210  03 81 81 00 9d 30 cc 40  2b 5b 50 a0 61 cb ba e5  |.....0.@+[P.a...|
+00000220  53 58 e1 ed 83 28 a9 58  1a a9 38 a4 95 a1 ac 31  |SX...(.X..8....1|
+00000230  5a 1a 84 66 3d 43 d3 2d  d9 0b f2 97 df d3 20 64  |Z..f=C.-...... d|
+00000240  38 92 24 3a 00 bc cf 9c  7d b7 40 20 01 5f aa d3  |8.$:....}.@ ._..|
+00000250  16 61 09 a2 76 fd 13 c3  cc e1 0c 5c ee b1 87 82  |.a..v......\....|
+00000260  f1 6c 04 ed 73 bb b3 43  77 8d 0c 1c f1 0f a1 d8  |.l..s..Cw.......|
+00000270  40 83 61 c9 4c 72 2b 9d  ae db 46 06 06 4d f4 c1  |@.a.Lr+...F..M..|
+00000280  b3 3e c0 d1 bd 42 d4 db  fe 3d 13 60 84 5c 21 d3  |.>...B...=.`.\!.|
+00000290  3b e9 fa e7 16 03 03 00  1b 0d 00 00 17 02 01 40  |;..............@|
+000002a0  00 10 04 01 04 03 05 01  05 03 06 01 06 03 02 01  |................|
+000002b0  02 03 00 00 16 03 03 00  04 0e 00 00 00           |.............|
+>>> Flow 3 (client to server)
+00000000  16 03 03 01 fd 0b 00 01  f9 00 01 f6 00 01 f3 30  |...............0|
+00000010  82 01 ef 30 82 01 58 a0  03 02 01 02 02 10 5c 19  |...0..X.......\.|
+00000020  c1 89 65 83 55 6f dc 0b  c9 b9 93 9f e9 bc 30 0d  |..e.Uo........0.|
+00000030  06 09 2a 86 48 86 f7 0d  01 01 0b 05 00 30 12 31  |..*.H........0.1|
+00000040  10 30 0e 06 03 55 04 0a  13 07 41 63 6d 65 20 43  |.0...U....Acme C|
+00000050  6f 30 1e 17 0d 31 36 30  38 31 37 32 31 35 32 33  |o0...16081721523|
+00000060  31 5a 17 0d 31 37 30 38  31 37 32 31 35 32 33 31  |1Z..170817215231|
+00000070  5a 30 12 31 10 30 0e 06  03 55 04 0a 13 07 41 63  |Z0.1.0...U....Ac|
+00000080  6d 65 20 43 6f 30 81 9f  30 0d 06 09 2a 86 48 86  |me Co0..0...*.H.|
+00000090  f7 0d 01 01 01 05 00 03  81 8d 00 30 81 89 02 81  |...........0....|
+000000a0  81 00 ba 6f aa 86 bd cf  bf 9f f2 ef 5c 94 60 78  |...o........\.`x|
+000000b0  6f e8 13 f2 d1 96 6f cd  d9 32 6e 22 37 ce 41 f9  |o.....o..2n"7.A.|
+000000c0  ca 5d 29 ac e1 27 da 61  a2 ee 81 cb 10 c7 df 34  |.])..'.a.......4|
+000000d0  58 95 86 e9 3d 19 e6 5c  27 73 60 c8 8d 78 02 f4  |X...=..\'s`..x..|
+000000e0  1d a4 98 09 a3 19 70 69  3c 25 62 66 2a ab 22 23  |......pi<%bf*."#|
+000000f0  c5 7b 85 38 4f 2e 09 73  32 a7 bd 3e 9b ad ca 84  |.{.8O..s2..>....|
+00000100  07 e6 0f 3a ff 77 c5 9d  41 85 00 8a b6 9b ee b0  |...:.w..A.......|
+00000110  a4 3f 2d 4c 4c e6 42 3e  bb 51 c8 dd 48 54 f4 0c  |.?-LL.B>.Q..HT..|
+00000120  8e 47 02 03 01 00 01 a3  46 30 44 30 0e 06 03 55  |.G......F0D0...U|
+00000130  1d 0f 01 01 ff 04 04 03  02 05 a0 30 13 06 03 55  |...........0...U|
+00000140  1d 25 04 0c 30 0a 06 08  2b 06 01 05 05 07 03 01  |.%..0...+.......|
+00000150  30 0c 06 03 55 1d 13 01  01 ff 04 02 30 00 30 0f  |0...U.......0.0.|
+00000160  06 03 55 1d 11 04 08 30  06 87 04 7f 00 00 01 30  |..U....0.......0|
+00000170  0d 06 09 2a 86 48 86 f7  0d 01 01 0b 05 00 03 81  |...*.H..........|
+00000180  81 00 46 ab 44 a2 fb 28  54 f8 5a 67 f8 62 94 f1  |..F.D..(T.Zg.b..|
+00000190  9a b2 18 9e f2 b1 de 1d  7e 6f 76 95 a9 ba e7 5d  |........~ov....]|
+000001a0  a8 16 6c 9c f7 09 d3 37  e4 4b 2b 36 7c 01 ad 41  |..l....7.K+6|..A|
+000001b0  d2 32 d8 c3 d2 93 f9 10  6b 8e 95 b9 2c 17 8a a3  |.2......k...,...|
+000001c0  44 48 bc 59 13 83 16 04  88 a4 81 5c 25 0d 98 0c  |DH.Y.......\%...|
+000001d0  ac 11 b1 28 56 be 1d cd  61 62 84 09 bf d6 80 c6  |...(V...ab......|
+000001e0  45 8d 82 2c b4 d8 83 9b  db c9 22 b7 2a 12 11 7b  |E..,......".*..{|
+000001f0  fa 02 3b c1 c9 ff ea c9  9d a8 49 d3 95 d7 d5 0e  |..;.......I.....|
+00000200  e5 35 16 03 03 00 86 10  00 00 82 00 80 3f 1b ee  |.5...........?..|
+00000210  02 ec a5 9f 6e 38 69 2c  b7 03 89 65 b4 92 79 a0  |....n8i,...e..y.|
+00000220  b2 0b ab 9b 44 9c 68 d1  8e 5c 40 9c b5 1c a5 70  |....D.h..\@....p|
+00000230  00 a2 2e fb 98 b7 45 7b  9c 63 46 68 1d 55 9e 01  |......E{.cFh.U..|
+00000240  7f 84 31 62 07 c4 2f 20  5f 1a 94 8c 1f f4 3a 6d  |..1b../ _.....:m|
+00000250  a8 2b b8 08 5b ec 27 e3  49 9e 51 b3 66 98 09 ba  |.+..[.'.I.Q.f...|
+00000260  64 65 c8 3c 11 fb 14 4a  c9 ea 3c 5e 52 10 a0 0b  |de.<...J..<^R...|
+00000270  a9 fc 10 13 c9 99 0c a0  8b b4 40 66 0e 11 5e 1d  |..........@f..^.|
+00000280  8b 45 5c 4d 0d 39 39 f6  0c 59 8f 06 99 16 03 03  |.E\M.99..Y......|
+00000290  00 88 0f 00 00 84 04 01  00 80 71 1c 9c fd b2 c9  |..........q.....|
+000002a0  b9 7f f3 51 e2 63 96 08  56 d2 bd 19 61 9f 3f be  |...Q.c..V...a.?.|
+000002b0  e5 4c 22 a8 3f 81 98 2d  67 56 4e 2d 61 6e 51 e5  |.L".?..-gVN-anQ.|
+000002c0  11 24 bd 1b 38 ba dc 8c  76 51 1d 3c 6e 81 50 9a  |.$..8...vQ.<n.P.|
+000002d0  b5 24 9c d8 af f7 80 8a  51 43 ec b3 59 18 bd ea  |.$......QC..Y...|
+000002e0  8a be af 11 c8 ac 60 88  e3 67 a2 ae c2 95 16 47  |......`..g.....G|
+000002f0  2b e2 ea 42 0a 0a 3f 2b  8b c8 ec 9d e7 b2 a6 ee  |+..B..?+........|
+00000300  f4 9b ba 28 47 e2 30 ae  05 89 09 65 3d b6 54 8a  |...(G.0....e=.T.|
+00000310  4a df d4 fa a5 4c 30 38  53 f2 14 03 03 00 01 01  |J....L08S.......|
+00000320  16 03 03 00 40 97 50 23  88 56 0d d4 1b ba 6f 3e  |....@.P#.V....o>|
+00000330  8d 82 6c f3 04 55 2c 13  d9 5b 0a 73 88 4f 8b 3c  |..l..U,..[.s.O.<|
+00000340  cd ef 1a a7 15 7c 33 bb  ff fa 01 c4 87 d7 df 47  |.....|3........G|
+00000350  37 b6 fe 1d e6 82 c2 8a  33 b1 c9 ae 85 45 c8 0d  |7.......3....E..|
+00000360  38 47 69 2d 54                                    |8Gi-T|
+>>> Flow 4 (server to client)
+00000000  14 03 03 00 01 01 16 03  03 00 40 00 00 00 00 00  |..........@.....|
+00000010  00 00 00 00 00 00 00 00  00 00 00 20 98 12 44 63  |........... ..Dc|
+00000020  e7 77 e6 e8 c0 c7 d7 b6  f7 c4 4e 13 e3 79 af 33  |.w........N..y.3|
+00000030  3b 6c 86 22 c5 9e dd 25  74 e5 7b 37 fb 24 c6 48  |;l."...%t.{7.$.H|
+00000040  c9 74 a7 9b 9b 32 a7 c1  b9 bb e0 17 03 03 00 40  |.t...2.........@|
+00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000060  80 d7 ec 51 cf ae d4 1a  af 11 59 d1 0c 62 a6 67  |...Q......Y..b.g|
+00000070  2e 6f 18 23 29 75 92 07  b1 16 09 8f 2d f8 04 fe  |.o.#)u......-...|
+00000080  ce 71 2c b6 00 fd 7b 53  cb 6d 97 06 06 e6 af f4  |.q,...{S.m......|
+00000090  15 03 03 00 30 00 00 00  00 00 00 00 00 00 00 00  |....0...........|
+000000a0  00 00 00 00 00 73 14 3a  87 3b ca 3a 2b b2 52 30  |.....s.:.;.:+.R0|
+000000b0  98 62 88 1b a7 58 66 47  66 72 fd bb b6 b7 6b 99  |.b...XfGfr....k.|
+000000c0  20 ab e9 22 62                                    | .."b|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required
new file mode 100644
index 0000000..86d5415
--- /dev/null
+++ b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required
@@ -0,0 +1,74 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 97 01 00 00  93 03 03 d7 9c de f8 62  |...............b|
+00000010  7e 32 5b bc d5 12 35 89  42 37 be ca 55 74 24 61  |~2[...5.B7..Ut$a|
+00000020  c0 50 91 0f 1b 42 29 9f  c1 6a cb 00 00 04 00 2f  |.P...B)..j...../|
+00000030  00 ff 01 00 00 66 00 00  00 0e 00 0c 00 00 09 31  |.....f.........1|
+00000040  32 37 2e 30 2e 30 2e 31  00 0b 00 04 03 00 01 02  |27.0.0.1........|
+00000050  00 0a 00 0c 00 0a 00 1d  00 17 00 1e 00 19 00 18  |................|
+00000060  00 16 00 00 00 17 00 00  00 0d 00 30 00 2e 04 03  |...........0....|
+00000070  05 03 06 03 08 07 08 08  08 09 08 0a 08 0b 08 04  |................|
+00000080  08 05 08 06 04 01 05 01  06 01 03 03 02 03 03 01  |................|
+00000090  02 01 03 02 02 02 04 02  05 02 06 02              |............|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 31 02 00 00  2d 03 03 00 00 00 00 00  |....1...-.......|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 44 4f 57 4e 47  52 44 01 00 00 2f 00 00  |...DOWNGRD.../..|
+00000030  05 ff 01 00 01 00 16 03  03 02 59 0b 00 02 55 00  |..........Y...U.|
+00000040  02 52 00 02 4f 30 82 02  4b 30 82 01 b4 a0 03 02  |.R..O0..K0......|
+00000050  01 02 02 09 00 e8 f0 9d  3f e2 5b ea a6 30 0d 06  |........?.[..0..|
+00000060  09 2a 86 48 86 f7 0d 01  01 0b 05 00 30 1f 31 0b  |.*.H........0.1.|
+00000070  30 09 06 03 55 04 0a 13  02 47 6f 31 10 30 0e 06  |0...U....Go1.0..|
+00000080  03 55 04 03 13 07 47 6f  20 52 6f 6f 74 30 1e 17  |.U....Go Root0..|
+00000090  0d 31 36 30 31 30 31 30  30 30 30 30 30 5a 17 0d  |.160101000000Z..|
+000000a0  32 35 30 31 30 31 30 30  30 30 30 30 5a 30 1a 31  |250101000000Z0.1|
+000000b0  0b 30 09 06 03 55 04 0a  13 02 47 6f 31 0b 30 09  |.0...U....Go1.0.|
+000000c0  06 03 55 04 03 13 02 47  6f 30 81 9f 30 0d 06 09  |..U....Go0..0...|
+000000d0  2a 86 48 86 f7 0d 01 01  01 05 00 03 81 8d 00 30  |*.H............0|
+000000e0  81 89 02 81 81 00 db 46  7d 93 2e 12 27 06 48 bc  |.......F}...'.H.|
+000000f0  06 28 21 ab 7e c4 b6 a2  5d fe 1e 52 45 88 7a 36  |.(!.~...]..RE.z6|
+00000100  47 a5 08 0d 92 42 5b c2  81 c0 be 97 79 98 40 fb  |G....B[.....y.@.|
+00000110  4f 6d 14 fd 2b 13 8b c2  a5 2e 67 d8 d4 09 9e d6  |Om..+.....g.....|
+00000120  22 38 b7 4a 0b 74 73 2b  c2 34 f1 d1 93 e5 96 d9  |"8.J.ts+.4......|
+00000130  74 7b f3 58 9f 6c 61 3c  c0 b0 41 d4 d9 2b 2b 24  |t{.X.la<..A..++$|
+00000140  23 77 5b 1c 3b bd 75 5d  ce 20 54 cf a1 63 87 1d  |#w[.;.u]. T..c..|
+00000150  1e 24 c4 f3 1d 1a 50 8b  aa b6 14 43 ed 97 a7 75  |.$....P....C...u|
+00000160  62 f4 14 c8 52 d7 02 03  01 00 01 a3 81 93 30 81  |b...R.........0.|
+00000170  90 30 0e 06 03 55 1d 0f  01 01 ff 04 04 03 02 05  |.0...U..........|
+00000180  a0 30 1d 06 03 55 1d 25  04 16 30 14 06 08 2b 06  |.0...U.%..0...+.|
+00000190  01 05 05 07 03 01 06 08  2b 06 01 05 05 07 03 02  |........+.......|
+000001a0  30 0c 06 03 55 1d 13 01  01 ff 04 02 30 00 30 19  |0...U.......0.0.|
+000001b0  06 03 55 1d 0e 04 12 04  10 9f 91 16 1f 43 43 3e  |..U..........CC>|
+000001c0  49 a6 de 6d b6 80 d7 9f  60 30 1b 06 03 55 1d 23  |I..m....`0...U.#|
+000001d0  04 14 30 12 80 10 48 13  49 4d 13 7e 16 31 bb a3  |..0...H.IM.~.1..|
+000001e0  01 d5 ac ab 6e 7b 30 19  06 03 55 1d 11 04 12 30  |....n{0...U....0|
+000001f0  10 82 0e 65 78 61 6d 70  6c 65 2e 67 6f 6c 61 6e  |...example.golan|
+00000200  67 30 0d 06 09 2a 86 48  86 f7 0d 01 01 0b 05 00  |g0...*.H........|
+00000210  03 81 81 00 9d 30 cc 40  2b 5b 50 a0 61 cb ba e5  |.....0.@+[P.a...|
+00000220  53 58 e1 ed 83 28 a9 58  1a a9 38 a4 95 a1 ac 31  |SX...(.X..8....1|
+00000230  5a 1a 84 66 3d 43 d3 2d  d9 0b f2 97 df d3 20 64  |Z..f=C.-...... d|
+00000240  38 92 24 3a 00 bc cf 9c  7d b7 40 20 01 5f aa d3  |8.$:....}.@ ._..|
+00000250  16 61 09 a2 76 fd 13 c3  cc e1 0c 5c ee b1 87 82  |.a..v......\....|
+00000260  f1 6c 04 ed 73 bb b3 43  77 8d 0c 1c f1 0f a1 d8  |.l..s..Cw.......|
+00000270  40 83 61 c9 4c 72 2b 9d  ae db 46 06 06 4d f4 c1  |@.a.Lr+...F..M..|
+00000280  b3 3e c0 d1 bd 42 d4 db  fe 3d 13 60 84 5c 21 d3  |.>...B...=.`.\!.|
+00000290  3b e9 fa e7 16 03 03 00  1b 0d 00 00 17 02 01 40  |;..............@|
+000002a0  00 10 04 01 04 03 05 01  05 03 06 01 06 03 02 01  |................|
+000002b0  02 03 00 00 16 03 03 00  04 0e 00 00 00           |.............|
+>>> Flow 3 (client to server)
+00000000  16 03 03 00 07 0b 00 00  03 00 00 00 16 03 03 00  |................|
+00000010  86 10 00 00 82 00 80 1d  c6 6c b0 b9 b3 41 06 80  |.........l...A..|
+00000020  e0 f5 df 06 ae 0f 2f 5f  72 14 44 47 16 c4 f0 a6  |....../_r.DG....|
+00000030  68 be fa ee ec 9b 38 b0  e4 bd a3 e9 ca 18 5b 25  |h.....8.......[%|
+00000040  33 31 57 86 63 59 0e ce  10 77 f8 42 a6 5c ad 3f  |31W.cY...w.B.\.?|
+00000050  80 85 a5 c1 06 4c 36 aa  f3 ee 62 39 66 69 76 51  |.....L6...b9fivQ|
+00000060  57 cc a0 b1 35 81 d5 38  01 2d 83 0e 2e 6b a9 84  |W...5..8.-...k..|
+00000070  0d 8b 29 93 90 78 2d 0d  33 5f 85 0d 00 0c e2 5f  |..)..x-.3_....._|
+00000080  83 21 28 27 83 ad 9d 19  2d 01 35 6d 85 2e 8d 6b  |.!('....-.5m...k|
+00000090  eb 7a cd 8a 3f 42 e2 14  03 03 00 01 01 16 03 03  |.z..?B..........|
+000000a0  00 40 5e 19 0f d0 4c 17  e0 25 e6 6b a1 d9 ea 59  |.@^...L..%.k...Y|
+000000b0  f4 3a 55 84 2c 50 1e 53  47 78 45 b8 97 f7 7f 3d  |.:U.,P.SGxE....=|
+000000c0  af d9 7a ad 30 30 77 1a  93 05 19 5b 9b 13 70 e0  |..z.00w....[..p.|
+000000d0  e0 f8 ba 6a bd 74 c5 71  0d 5a 2c 3f 2d 98 1a 3c  |...j.t.q.Z,?-..<|
+000000e0  5a 7d                                             |Z}|
+>>> Flow 4 (server to client)
+00000000  15 03 03 00 02 02 2a                              |......*|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled
new file mode 100644
index 0000000..302e64e
--- /dev/null
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled
@@ -0,0 +1,84 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 cb 01 00 00  c7 03 03 ed 3d 3e 10 95  |............=>..|
+00000010  8b 6f 6c be 5c b7 77 c0  79 91 f8 b3 6f 52 27 18  |.ol.\.w.y...oR'.|
+00000020  0a b7 88 52 df 3c 6c 87  b4 5a 4c 00 00 38 c0 2c  |...R.<l..ZL..8.,|
+00000030  c0 30 00 9f cc a9 cc a8  cc aa c0 2b c0 2f 00 9e  |.0.........+./..|
+00000040  c0 24 c0 28 00 6b c0 23  c0 27 00 67 c0 0a c0 14  |.$.(.k.#.'.g....|
+00000050  00 39 c0 09 c0 13 00 33  00 9d 00 9c 00 3d 00 3c  |.9.....3.....=.<|
+00000060  00 35 00 2f 00 ff 01 00  00 66 00 00 00 0e 00 0c  |.5./.....f......|
+00000070  00 00 09 31 32 37 2e 30  2e 30 2e 31 00 0b 00 04  |...127.0.0.1....|
+00000080  03 00 01 02 00 0a 00 0c  00 0a 00 1d 00 17 00 1e  |................|
+00000090  00 19 00 18 00 16 00 00  00 17 00 00 00 0d 00 30  |...............0|
+000000a0  00 2e 04 03 05 03 06 03  08 07 08 08 08 09 08 0a  |................|
+000000b0  08 0b 08 04 08 05 08 06  04 01 05 01 06 01 03 03  |................|
+000000c0  02 03 03 01 02 01 03 02  02 02 04 02 05 02 06 02  |................|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 31 02 00 00  2d 03 03 00 00 00 00 00  |....1...-.......|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 44 4f 57 4e 47  52 44 01 00 c0 30 00 00  |...DOWNGRD...0..|
+00000030  05 ff 01 00 01 00 16 03  03 02 59 0b 00 02 55 00  |..........Y...U.|
+00000040  02 52 00 02 4f 30 82 02  4b 30 82 01 b4 a0 03 02  |.R..O0..K0......|
+00000050  01 02 02 09 00 e8 f0 9d  3f e2 5b ea a6 30 0d 06  |........?.[..0..|
+00000060  09 2a 86 48 86 f7 0d 01  01 0b 05 00 30 1f 31 0b  |.*.H........0.1.|
+00000070  30 09 06 03 55 04 0a 13  02 47 6f 31 10 30 0e 06  |0...U....Go1.0..|
+00000080  03 55 04 03 13 07 47 6f  20 52 6f 6f 74 30 1e 17  |.U....Go Root0..|
+00000090  0d 31 36 30 31 30 31 30  30 30 30 30 30 5a 17 0d  |.160101000000Z..|
+000000a0  32 35 30 31 30 31 30 30  30 30 30 30 5a 30 1a 31  |250101000000Z0.1|
+000000b0  0b 30 09 06 03 55 04 0a  13 02 47 6f 31 0b 30 09  |.0...U....Go1.0.|
+000000c0  06 03 55 04 03 13 02 47  6f 30 81 9f 30 0d 06 09  |..U....Go0..0...|
+000000d0  2a 86 48 86 f7 0d 01 01  01 05 00 03 81 8d 00 30  |*.H............0|
+000000e0  81 89 02 81 81 00 db 46  7d 93 2e 12 27 06 48 bc  |.......F}...'.H.|
+000000f0  06 28 21 ab 7e c4 b6 a2  5d fe 1e 52 45 88 7a 36  |.(!.~...]..RE.z6|
+00000100  47 a5 08 0d 92 42 5b c2  81 c0 be 97 79 98 40 fb  |G....B[.....y.@.|
+00000110  4f 6d 14 fd 2b 13 8b c2  a5 2e 67 d8 d4 09 9e d6  |Om..+.....g.....|
+00000120  22 38 b7 4a 0b 74 73 2b  c2 34 f1 d1 93 e5 96 d9  |"8.J.ts+.4......|
+00000130  74 7b f3 58 9f 6c 61 3c  c0 b0 41 d4 d9 2b 2b 24  |t{.X.la<..A..++$|
+00000140  23 77 5b 1c 3b bd 75 5d  ce 20 54 cf a1 63 87 1d  |#w[.;.u]. T..c..|
+00000150  1e 24 c4 f3 1d 1a 50 8b  aa b6 14 43 ed 97 a7 75  |.$....P....C...u|
+00000160  62 f4 14 c8 52 d7 02 03  01 00 01 a3 81 93 30 81  |b...R.........0.|
+00000170  90 30 0e 06 03 55 1d 0f  01 01 ff 04 04 03 02 05  |.0...U..........|
+00000180  a0 30 1d 06 03 55 1d 25  04 16 30 14 06 08 2b 06  |.0...U.%..0...+.|
+00000190  01 05 05 07 03 01 06 08  2b 06 01 05 05 07 03 02  |........+.......|
+000001a0  30 0c 06 03 55 1d 13 01  01 ff 04 02 30 00 30 19  |0...U.......0.0.|
+000001b0  06 03 55 1d 0e 04 12 04  10 9f 91 16 1f 43 43 3e  |..U..........CC>|
+000001c0  49 a6 de 6d b6 80 d7 9f  60 30 1b 06 03 55 1d 23  |I..m....`0...U.#|
+000001d0  04 14 30 12 80 10 48 13  49 4d 13 7e 16 31 bb a3  |..0...H.IM.~.1..|
+000001e0  01 d5 ac ab 6e 7b 30 19  06 03 55 1d 11 04 12 30  |....n{0...U....0|
+000001f0  10 82 0e 65 78 61 6d 70  6c 65 2e 67 6f 6c 61 6e  |...example.golan|
+00000200  67 30 0d 06 09 2a 86 48  86 f7 0d 01 01 0b 05 00  |g0...*.H........|
+00000210  03 81 81 00 9d 30 cc 40  2b 5b 50 a0 61 cb ba e5  |.....0.@+[P.a...|
+00000220  53 58 e1 ed 83 28 a9 58  1a a9 38 a4 95 a1 ac 31  |SX...(.X..8....1|
+00000230  5a 1a 84 66 3d 43 d3 2d  d9 0b f2 97 df d3 20 64  |Z..f=C.-...... d|
+00000240  38 92 24 3a 00 bc cf 9c  7d b7 40 20 01 5f aa d3  |8.$:....}.@ ._..|
+00000250  16 61 09 a2 76 fd 13 c3  cc e1 0c 5c ee b1 87 82  |.a..v......\....|
+00000260  f1 6c 04 ed 73 bb b3 43  77 8d 0c 1c f1 0f a1 d8  |.l..s..Cw.......|
+00000270  40 83 61 c9 4c 72 2b 9d  ae db 46 06 06 4d f4 c1  |@.a.Lr+...F..M..|
+00000280  b3 3e c0 d1 bd 42 d4 db  fe 3d 13 60 84 5c 21 d3  |.>...B...=.`.\!.|
+00000290  3b e9 fa e7 16 03 03 00  ac 0c 00 00 a8 03 00 1d  |;...............|
+000002a0  20 2f e5 7d a3 47 cd 62  43 15 28 da ac 5f bb 29  | /.}.G.bC.(.._.)|
+000002b0  07 30 ff f6 84 af c4 cf  c2 ed 90 99 5f 58 cb 3b  |.0.........._X.;|
+000002c0  74 04 01 00 80 a5 a9 75  be 51 ff dc b3 bb 77 79  |t......u.Q....wy|
+000002d0  ef 5b 9f d9 27 6c 76 ea  ce 5c 66 20 03 2e 94 fd  |.[..'lv..\f ....|
+000002e0  28 94 69 ff 06 ab bd 34  43 51 72 fb 15 42 e6 38  |(.i....4CQr..B.8|
+000002f0  c5 7a 5d 7f 35 a7 3c 85  ec df 95 23 0f 28 c7 dc  |.z].5.<....#.(..|
+00000300  0e a6 ec fe 5e 77 3f 95  1d a7 73 1d d8 7b 68 92  |....^w?...s..{h.|
+00000310  5b a5 b8 ba f5 7c a5 60  2e 43 d6 60 64 3e 33 c7  |[....|.`.C.`d>3.|
+00000320  8b c2 56 68 e3 28 2b 2e  8b 9a 85 29 77 73 24 3e  |..Vh.(+....)ws$>|
+00000330  2b 95 b8 40 a7 f1 60 b5  9e 85 3e 1d ae ab 7f 85  |+..@..`...>.....|
+00000340  63 63 d1 cf 62 16 03 03  00 04 0e 00 00 00        |cc..b.........|
+>>> Flow 3 (client to server)
+00000000  16 03 03 00 25 10 00 00  21 20 43 dd 3e 28 34 9f  |....%...! C.>(4.|
+00000010  a9 0c 8e 14 66 01 a1 dd  15 8e 71 b4 05 83 d9 a3  |....f.....q.....|
+00000020  5f 5c a3 31 ad 5c d5 5a  ad 56 14 03 03 00 01 01  |_\.1.\.Z.V......|
+00000030  16 03 03 00 28 f3 ad d2  ec 9e 1e 85 2d 96 5f bc  |....(.......-._.|
+00000040  70 cc 0a c2 22 ef 0a fe  fb b0 77 f1 59 59 08 a6  |p...".....w.YY..|
+00000050  57 39 16 00 82 0b 60 1e  9a 74 75 3a 8a           |W9....`..tu:.|
+>>> Flow 4 (server to client)
+00000000  14 03 03 00 01 01 16 03  03 00 28 00 00 00 00 00  |..........(.....|
+00000010  00 00 00 cf 63 14 29 73  c7 7b 6c 98 50 db 5f 8e  |....c.)s.{l.P._.|
+00000020  f4 de 68 bc c0 60 2c db  9e 1f d9 48 55 51 05 47  |..h..`,....HUQ.G|
+00000030  7e 43 37 17 03 03 00 25  00 00 00 00 00 00 00 01  |~C7....%........|
+00000040  67 0a e7 77 dd 1a 30 87  27 90 b0 42 31 42 09 53  |g..w..0.'..B1B.S|
+00000050  03 bf 0c 10 3a c3 a7 95  e9 6e 63 57 ad 15 03 03  |....:....ncW....|
+00000060  00 1a 00 00 00 00 00 00  00 02 d5 1a ac 66 50 93  |.............fP.|
+00000070  46 0a da 98 1f cc 30 40  c1 47 c7 88              |F.....0@.G..|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required b/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required
new file mode 100644
index 0000000..9e9570f
--- /dev/null
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required
@@ -0,0 +1,54 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 91 01 00 00  8d 03 03 5a 8a 66 22 31  |...........Z.f"1|
+00000010  69 92 30 d5 7b 7c 17 a7  7c 14 d6 3c a9 9e ba dd  |i.0.{|..|..<....|
+00000020  7c 73 fe b4 b4 dd d8 28  39 32 0d 00 00 2a c0 30  ||s.....(92...*.0|
+00000030  00 9f cc a8 cc aa c0 2f  00 9e c0 28 00 6b c0 27  |......./...(.k.'|
+00000040  00 67 c0 14 00 39 c0 13  00 33 00 9d 00 9c 00 3d  |.g...9...3.....=|
+00000050  00 3c 00 35 00 2f 00 ff  01 00 00 3a 00 00 00 0e  |.<.5./.....:....|
+00000060  00 0c 00 00 09 31 32 37  2e 30 2e 30 2e 31 00 0b  |.....127.0.0.1..|
+00000070  00 04 03 00 01 02 00 0a  00 0c 00 0a 00 1d 00 17  |................|
+00000080  00 1e 00 19 00 18 00 16  00 00 00 17 00 00 00 0d  |................|
+00000090  00 04 00 02 08 04                                 |......|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 31 02 00 00  2d 03 03 00 00 00 00 00  |....1...-.......|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 44 4f 57 4e 47  52 44 01 00 c0 30 00 00  |...DOWNGRD...0..|
+00000030  05 ff 01 00 01 00 16 03  03 02 59 0b 00 02 55 00  |..........Y...U.|
+00000040  02 52 00 02 4f 30 82 02  4b 30 82 01 b4 a0 03 02  |.R..O0..K0......|
+00000050  01 02 02 09 00 e8 f0 9d  3f e2 5b ea a6 30 0d 06  |........?.[..0..|
+00000060  09 2a 86 48 86 f7 0d 01  01 0b 05 00 30 1f 31 0b  |.*.H........0.1.|
+00000070  30 09 06 03 55 04 0a 13  02 47 6f 31 10 30 0e 06  |0...U....Go1.0..|
+00000080  03 55 04 03 13 07 47 6f  20 52 6f 6f 74 30 1e 17  |.U....Go Root0..|
+00000090  0d 31 36 30 31 30 31 30  30 30 30 30 30 5a 17 0d  |.160101000000Z..|
+000000a0  32 35 30 31 30 31 30 30  30 30 30 30 5a 30 1a 31  |250101000000Z0.1|
+000000b0  0b 30 09 06 03 55 04 0a  13 02 47 6f 31 0b 30 09  |.0...U....Go1.0.|
+000000c0  06 03 55 04 03 13 02 47  6f 30 81 9f 30 0d 06 09  |..U....Go0..0...|
+000000d0  2a 86 48 86 f7 0d 01 01  01 05 00 03 81 8d 00 30  |*.H............0|
+000000e0  81 89 02 81 81 00 db 46  7d 93 2e 12 27 06 48 bc  |.......F}...'.H.|
+000000f0  06 28 21 ab 7e c4 b6 a2  5d fe 1e 52 45 88 7a 36  |.(!.~...]..RE.z6|
+00000100  47 a5 08 0d 92 42 5b c2  81 c0 be 97 79 98 40 fb  |G....B[.....y.@.|
+00000110  4f 6d 14 fd 2b 13 8b c2  a5 2e 67 d8 d4 09 9e d6  |Om..+.....g.....|
+00000120  22 38 b7 4a 0b 74 73 2b  c2 34 f1 d1 93 e5 96 d9  |"8.J.ts+.4......|
+00000130  74 7b f3 58 9f 6c 61 3c  c0 b0 41 d4 d9 2b 2b 24  |t{.X.la<..A..++$|
+00000140  23 77 5b 1c 3b bd 75 5d  ce 20 54 cf a1 63 87 1d  |#w[.;.u]. T..c..|
+00000150  1e 24 c4 f3 1d 1a 50 8b  aa b6 14 43 ed 97 a7 75  |.$....P....C...u|
+00000160  62 f4 14 c8 52 d7 02 03  01 00 01 a3 81 93 30 81  |b...R.........0.|
+00000170  90 30 0e 06 03 55 1d 0f  01 01 ff 04 04 03 02 05  |.0...U..........|
+00000180  a0 30 1d 06 03 55 1d 25  04 16 30 14 06 08 2b 06  |.0...U.%..0...+.|
+00000190  01 05 05 07 03 01 06 08  2b 06 01 05 05 07 03 02  |........+.......|
+000001a0  30 0c 06 03 55 1d 13 01  01 ff 04 02 30 00 30 19  |0...U.......0.0.|
+000001b0  06 03 55 1d 0e 04 12 04  10 9f 91 16 1f 43 43 3e  |..U..........CC>|
+000001c0  49 a6 de 6d b6 80 d7 9f  60 30 1b 06 03 55 1d 23  |I..m....`0...U.#|
+000001d0  04 14 30 12 80 10 48 13  49 4d 13 7e 16 31 bb a3  |..0...H.IM.~.1..|
+000001e0  01 d5 ac ab 6e 7b 30 19  06 03 55 1d 11 04 12 30  |....n{0...U....0|
+000001f0  10 82 0e 65 78 61 6d 70  6c 65 2e 67 6f 6c 61 6e  |...example.golan|
+00000200  67 30 0d 06 09 2a 86 48  86 f7 0d 01 01 0b 05 00  |g0...*.H........|
+00000210  03 81 81 00 9d 30 cc 40  2b 5b 50 a0 61 cb ba e5  |.....0.@+[P.a...|
+00000220  53 58 e1 ed 83 28 a9 58  1a a9 38 a4 95 a1 ac 31  |SX...(.X..8....1|
+00000230  5a 1a 84 66 3d 43 d3 2d  d9 0b f2 97 df d3 20 64  |Z..f=C.-...... d|
+00000240  38 92 24 3a 00 bc cf 9c  7d b7 40 20 01 5f aa d3  |8.$:....}.@ ._..|
+00000250  16 61 09 a2 76 fd 13 c3  cc e1 0c 5c ee b1 87 82  |.a..v......\....|
+00000260  f1 6c 04 ed 73 bb b3 43  77 8d 0c 1c f1 0f a1 d8  |.l..s..Cw.......|
+00000270  40 83 61 c9 4c 72 2b 9d  ae db 46 06 06 4d f4 c1  |@.a.Lr+...F..M..|
+00000280  b3 3e c0 d1 bd 42 d4 db  fe 3d 13 60 84 5c 21 d3  |.>...B...=.`.\!.|
+00000290  3b e9 fa e7 15 03 03 00  02 02 28                 |;.........(|
diff --git a/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled
new file mode 100644
index 0000000..89361f1
--- /dev/null
+++ b/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled
@@ -0,0 +1,182 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 e0 01 00 00  dc 03 03 32 03 2a b3 ed  |...........2.*..|
+00000010  c2 1a 71 f2 ff ea 0b 1c  fa f9 c6 88 03 7c 84 89  |..q..........|..|
+00000020  4e 45 60 81 d9 58 dc 9f  0a 60 d1 20 ce 4d 59 a5  |NE`..X...`. .MY.|
+00000030  10 b1 76 53 f5 77 26 fd  17 08 f9 e5 14 03 c4 0a  |..vS.w&.........|
+00000040  65 fd 83 bb a9 3b 24 05  24 1b ef 00 00 08 13 02  |e....;$.$.......|
+00000050  13 03 13 01 00 ff 01 00  00 8b 00 00 00 0e 00 0c  |................|
+00000060  00 00 09 31 32 37 2e 30  2e 30 2e 31 00 0b 00 04  |...127.0.0.1....|
+00000070  03 00 01 02 00 0a 00 0c  00 0a 00 1d 00 17 00 1e  |................|
+00000080  00 19 00 18 00 16 00 00  00 17 00 00 00 0d 00 1e  |................|
+00000090  00 1c 04 03 05 03 06 03  08 07 08 08 08 09 08 0a  |................|
+000000a0  08 0b 08 04 08 05 08 06  04 01 05 01 06 01 00 2b  |...............+|
+000000b0  00 03 02 03 04 00 2d 00  02 01 01 00 33 00 26 00  |......-.....3.&.|
+000000c0  24 00 1d 00 20 06 b0 03  80 81 d6 e7 f4 31 85 4c  |$... ........1.L|
+000000d0  e3 50 35 c1 df 6e 28 9f  38 ce c0 7b fc 71 00 8c  |.P5..n(.8..{.q..|
+000000e0  9a 25 07 95 57                                    |.%..W|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 7a 02 00 00  76 03 03 00 00 00 00 00  |....z...v.......|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 00 00 00 00 00  00 00 00 20 ce 4d 59 a5  |........... .MY.|
+00000030  10 b1 76 53 f5 77 26 fd  17 08 f9 e5 14 03 c4 0a  |..vS.w&.........|
+00000040  65 fd 83 bb a9 3b 24 05  24 1b ef 00 13 02 00 00  |e....;$.$.......|
+00000050  2e 00 2b 00 02 03 04 00  33 00 24 00 1d 00 20 2f  |..+.....3.$... /|
+00000060  e5 7d a3 47 cd 62 43 15  28 da ac 5f bb 29 07 30  |.}.G.bC.(.._.).0|
+00000070  ff f6 84 af c4 cf c2 ed  90 99 5f 58 cb 3b 74 14  |.........._X.;t.|
+00000080  03 03 00 01 01 17 03 03  00 17 ad ce ff 21 b8 39  |.............!.9|
+00000090  16 f6 10 6e 8d 6c 0f 46  2f 58 55 b3 e4 4f 2d 5c  |...n.l.F/XU..O-\|
+000000a0  26 17 03 03 00 3c fd 24  07 75 28 2b f2 ec d9 74  |&....<.$.u(+...t|
+000000b0  f0 76 e4 02 e6 02 bd 47  58 0f 68 60 ac 6c 59 a8  |.v.....GX.h`.lY.|
+000000c0  87 94 b9 cb c3 fa 41 15  4c 95 b8 58 da 8c d9 ea  |......A.L..X....|
+000000d0  3a ab 0c 06 83 a5 2b d1  39 6f 32 92 bf e1 c0 f4  |:.....+.9o2.....|
+000000e0  49 51 17 03 03 02 6d 22  dc 8c fc ae 21 96 41 17  |IQ....m"....!.A.|
+000000f0  45 93 6e 08 61 6b 46 b9  9a cf 2e 79 a8 1a 46 30  |E.n.akF....y..F0|
+00000100  a4 de 3d 53 87 bf 57 3a  44 4f 5b 3f c9 b2 f0 0e  |..=S..W:DO[?....|
+00000110  56 5f 5a ee 5a 1f df cc  fe f3 54 ab 87 d7 bb 00  |V_Z.Z.....T.....|
+00000120  2c 61 de ad 31 9c d4 cf  43 bf e7 84 d1 1d 3c cb  |,a..1...C.....<.|
+00000130  82 d1 81 9d 13 90 6b c8  fd 01 53 4f 13 a5 91 a4  |......k...SO....|
+00000140  fe 20 ce 2c 34 96 62 b7  6f f0 f0 65 f0 01 18 99  |. .,4.b.o..e....|
+00000150  31 3d cb c6 72 6f 54 d6  ec fa a3 dd 94 67 6b b9  |1=..roT......gk.|
+00000160  ff 2c 41 ba 00 d5 25 ba  b1 7a e5 d2 1c 0b 37 ad  |.,A...%..z....7.|
+00000170  df 0b 62 be b3 69 5b 84  39 2d 72 c2 b9 ec 68 87  |..b..i[.9-r...h.|
+00000180  32 23 92 4b a8 f0 17 25  0f d7 86 97 45 65 73 e1  |2#.K...%....Ees.|
+00000190  49 c4 3c 8d 26 43 34 06  4c be 50 76 ae 63 6f 1d  |I.<.&C4.L.Pv.co.|
+000001a0  ed 57 93 5a 7f 98 e2 1e  5f 94 74 a2 54 59 63 12  |.W.Z...._.t.TYc.|
+000001b0  bb 8b df 77 20 3a 9c ea  c7 40 b0 cf 8e 7f f8 98  |...w :...@......|
+000001c0  06 92 38 be 77 11 17 03  c2 ac af fc 8d 7d d5 6b  |..8.w........}.k|
+000001d0  f7 2b 7a f3 b8 dc b0 cf  3e f7 c5 f4 b3 34 4b 06  |.+z.....>....4K.|
+000001e0  c6 ed b5 dc 0c 2d 4e bc  03 94 cc 03 f2 9f 5d c6  |.....-N.......].|
+000001f0  57 36 5a 01 81 65 27 75  1d 4f 22 9f b5 da 7f e2  |W6Z..e'u.O".....|
+00000200  7d 36 f3 4b 05 3f 40 47  c6 1b af e6 99 c0 ca 35  |}6.K.?@G.......5|
+00000210  98 c8 30 60 7b 42 4e e7  5c 90 28 d7 4e db f3 78  |..0`{BN.\.(.N..x|
+00000220  22 e2 a3 86 0c 9e 19 43  0e 89 d4 f6 78 38 21 16  |"......C....x8!.|
+00000230  84 38 36 6a 2d a5 94 2c  52 2b 00 de 67 16 e8 89  |.86j-..,R+..g...|
+00000240  32 21 0e fd b0 23 91 06  8b fa 82 70 21 bc 1f 29  |2!...#.....p!..)|
+00000250  32 af f4 b9 15 7f aa 22  c1 e8 e3 2c 92 b4 d8 2a  |2......"...,...*|
+00000260  64 58 f4 f1 85 85 14 92  f3 16 8e 2d 5b a6 7e ef  |dX.........-[.~.|
+00000270  22 5a 58 bb 4c f1 36 70  2f ca 03 df fb 0a d0 03  |"ZX.L.6p/.......|
+00000280  55 5d d9 6b 63 48 d2 75  82 d4 56 af 17 5a 60 4f  |U].kcH.u..V..Z`O|
+00000290  af 8b 17 d6 fd 96 be 3d  82 25 0e 73 2e 58 0e 0a  |.......=.%.s.X..|
+000002a0  5c 2d c8 f5 17 b0 ae 7d  39 90 cb 75 bb 4b 33 22  |\-.....}9..u.K3"|
+000002b0  bd a2 02 00 70 43 a8 54  ee 7c 25 d5 d7 88 08 f6  |....pC.T.|%.....|
+000002c0  3f 34 61 55 f5 d3 53 0c  8c b1 9b fd 4e d9 65 7a  |?4aU..S.....N.ez|
+000002d0  2b 6e b4 d5 37 34 18 f3  14 00 9f 56 40 d9 15 ea  |+n..74.....V@...|
+000002e0  59 5a 4b 4a bb f7 19 72  60 4a 08 8f 75 d6 7b a4  |YZKJ...r`J..u.{.|
+000002f0  de 79 c5 21 1a cb 82 97  b3 88 d8 ae 65 30 cc 56  |.y.!........e0.V|
+00000300  da a3 04 5c 63 f4 44 a5  eb 05 55 ad 78 46 44 ac  |...\c.D...U.xFD.|
+00000310  56 2e f6 f7 eb 47 f6 f1  62 8d df 27 7d 86 5e 58  |V....G..b..'}.^X|
+00000320  5f 4c 34 6e f6 c0 fd 56  7d 46 82 5d 53 db 2a 84  |_L4n...V}F.]S.*.|
+00000330  45 db e7 9c b9 23 32 59  cf 85 f7 12 c5 e8 9e 3c  |E....#2Y.......<|
+00000340  2d 3f 81 a5 24 cf 36 ad  d6 65 02 35 84 de 43 f8  |-?..$.6..e.5..C.|
+00000350  04 e2 8b ae 17 03 03 00  99 ce e8 48 a3 34 5e fb  |...........H.4^.|
+00000360  76 f1 e4 3b da 94 0a 25  ee 78 f6 31 24 10 05 25  |v..;...%.x.1$..%|
+00000370  9c e5 ca fc ef c5 66 86  08 15 d8 69 75 d8 49 e9  |......f....iu.I.|
+00000380  9b 86 71 3f 1f 41 ee f0  bc 8d 4e aa bc 30 f0 8f  |..q?.A....N..0..|
+00000390  7b b1 94 7e aa 74 3f eb  23 c5 c9 aa 9a c3 f7 12  |{..~.t?.#.......|
+000003a0  23 30 95 2e e1 1b 9c fe  8b 50 b1 d9 17 cf af a1  |#0.......P......|
+000003b0  ff ce 8d fa 7e bd 23 59  d0 7a fb 30 12 f4 8d 86  |....~.#Y.z.0....|
+000003c0  0c 3c fd 03 50 d4 7f bb  f6 fa ba 1d fc 32 cc 7e  |.<..P........2.~|
+000003d0  12 3a 33 90 c6 82 5d 6a  90 23 6d b8 e6 60 7d d3  |.:3...]j.#m..`}.|
+000003e0  a8 f0 0c 75 bc b5 67 68  ed 58 ef 4d ac 91 47 c9  |...u..gh.X.M..G.|
+000003f0  c4 bc 17 03 03 00 45 ae  0d 8d 76 8d 28 34 1b 09  |......E...v.(4..|
+00000400  4d d5 df 2e aa f8 ff 71  b2 0e 60 a1 ce 8a 58 9c  |M......q..`...X.|
+00000410  45 64 31 6c 9b 46 66 64  27 98 e6 f3 93 e8 92 81  |Ed1l.Ffd'.......|
+00000420  3d 4f db da 98 72 0d b7  71 27 ac 2b 61 81 97 0b  |=O...r..q'.+a...|
+00000430  e7 ae 32 d7 e2 66 4d 5d  f7 01 d0 77              |..2..fM]...w|
+>>> Flow 3 (client to server)
+00000000  14 03 03 00 01 01 17 03  03 02 11 f6 03 90 9e bc  |................|
+00000010  dc 00 9b f9 dd 7b 65 dd  b0 69 b4 b5 42 fc 25 f2  |.....{e..i..B.%.|
+00000020  2b 7e be 52 1a 4b f1 e4  21 94 0d 88 4a 58 07 37  |+~.R.K..!...JX.7|
+00000030  67 c7 e3 c4 62 eb 17 57  5d 52 d4 a9 03 39 0e 7d  |g...b..W]R...9.}|
+00000040  d0 c3 1a 8d ef ec b7 a8  9b 93 50 0d 7f fd a1 10  |..........P.....|
+00000050  b6 82 99 21 3f e3 3d 3d  47 04 c3 cd a7 b3 ab e0  |...!?.==G.......|
+00000060  f6 33 47 0e 1c 30 36 45  21 32 34 c2 2c 72 20 72  |.3G..06E!24.,r r|
+00000070  b6 c7 5b 95 8a 97 84 54  2e d0 5f d5 80 e7 8f 7a  |..[....T.._....z|
+00000080  6f 50 96 8a 33 13 c6 97  85 25 47 6b 8a b2 a0 29  |oP..3....%Gk...)|
+00000090  cd 7f 0e 38 94 53 08 8b  c3 2f 89 a2 10 c2 22 5a  |...8.S.../...."Z|
+000000a0  95 42 a3 45 73 a8 d0 ac  6d ba 95 a4 51 63 b9 b4  |.B.Es...m...Qc..|
+000000b0  79 61 be dd c6 ab 97 72  38 30 63 55 a7 7d 9a eb  |ya.....r80cU.}..|
+000000c0  bb 5a f6 d0 3d 05 81 5d  0e e5 7a 8b ae fe d2 3b  |.Z..=..]..z....;|
+000000d0  db 85 3a 13 81 ee 36 b3  ff 41 47 d1 67 bf 17 5e  |..:...6..AG.g..^|
+000000e0  9d a3 4c 92 51 a9 1b 4b  ca 13 f6 ee 8a e5 b3 01  |..L.Q..K........|
+000000f0  e7 87 ee 1e 2a 9e 56 3d  01 7e 0f cb e5 d6 ea 13  |....*.V=.~......|
+00000100  05 3e 8c 5a 24 d0 36 6b  54 9f 8e 3f 07 73 a0 bf  |.>.Z$.6kT..?.s..|
+00000110  84 c2 90 72 ce 48 50 49  47 27 b3 14 56 5c c7 63  |...r.HPIG'..V\.c|
+00000120  7e 7e b5 8f 9d 6d 70 32  6f 3f 4d 53 80 ae f6 2b  |~~...mp2o?MS...+|
+00000130  fb c9 7a de 76 aa 68 a3  9b a9 a7 47 55 d0 cb f8  |..z.v.h....GU...|
+00000140  e8 c4 1c f5 0f 54 82 5b  c5 45 18 41 05 da 72 ce  |.....T.[.E.A..r.|
+00000150  84 d1 8b 00 40 e9 f9 cf  b5 d5 3e 71 ee 25 dc 7d  |....@.....>q.%.}|
+00000160  3b 00 67 68 9d 78 d2 c0  7b cb 5d 9e 79 2c b5 f4  |;.gh.x..{.].y,..|
+00000170  1b ea b8 d8 de bd 36 71  2a 26 49 44 1b 5b 92 ad  |......6q*&ID.[..|
+00000180  1c 2d 2f ab 8e 15 d7 b3  96 89 da 58 77 75 42 32  |.-/........XwuB2|
+00000190  c3 6b f1 5e 0b da 91 71  1e d5 f1 dd 32 d8 b6 a5  |.k.^...q....2...|
+000001a0  21 a1 1d 5e b1 df 01 37  33 ac 93 11 94 6d b8 e6  |!..^...73....m..|
+000001b0  3b be 86 31 da cf b6 ab  cd f5 12 4f 85 45 24 06  |;..1.......O.E$.|
+000001c0  34 40 7b c5 f8 5f c3 f9  3b cf 9d 2a b3 2e 65 e4  |4@{.._..;..*..e.|
+000001d0  0e ed fc 7c b4 2b 32 bf  0e 8f b3 85 93 74 8b e8  |...|.+2......t..|
+000001e0  25 e0 47 c0 d8 52 8e c9  ed 7f 16 41 3f b3 79 d8  |%.G..R.....A?.y.|
+000001f0  d1 47 19 ae fb ab 97 a5  b2 42 7c a0 73 ad 4f 62  |.G.......B|.s.Ob|
+00000200  cf 35 52 7c d6 47 b8 1f  e9 65 b0 99 f7 67 e7 64  |.5R|.G...e...g.d|
+00000210  14 83 46 c7 90 6e 4d 01  3a c2 e6 19 17 03 03 00  |..F..nM.:.......|
+00000220  99 a5 e0 38 3a 91 4a 1d  87 9a eb a6 95 87 35 fc  |...8:.J.......5.|
+00000230  ae 42 8d 3a fe f6 39 f3  c2 c2 f0 9a f5 8f b5 75  |.B.:..9........u|
+00000240  18 6b 84 c0 5b 96 6a 9c  0c aa 81 fc 9a 2e 01 f7  |.k..[.j.........|
+00000250  d8 b1 5d 4a 54 cf 79 90  fb 79 57 ff d9 d1 46 59  |..]JT.y..yW...FY|
+00000260  02 84 3d ee cc 68 ea 05  1d a2 79 fb 1d 1e d6 ad  |..=..h....y.....|
+00000270  5b 95 3b 6b 9a c9 07 e5  e4 20 07 6a a0 74 c8 1a  |[.;k..... .j.t..|
+00000280  31 53 a4 e6 bb bb 28 61  47 41 d5 f3 45 38 71 86  |1S....(aGA..E8q.|
+00000290  35 12 f4 8a f2 e4 e9 ae  96 a9 14 ce 8a 1c 5d 59  |5.............]Y|
+000002a0  3c d7 3a e7 93 35 c2 53  9f d8 4d cb 98 bd e1 72  |<.:..5.S..M....r|
+000002b0  a8 80 55 a6 cd 9c 50 41  ec 50 17 03 03 00 45 2d  |..U...PA.P....E-|
+000002c0  90 3b 73 cc 24 52 ad 22  90 0e 7d bf 2a a2 44 09  |.;s.$R."..}.*.D.|
+000002d0  e2 43 61 f2 48 9b 73 85  00 05 8b 0a 51 ad a0 c0  |.Ca.H.s.....Q...|
+000002e0  64 ef 5e 11 86 37 b0 32  af 11 f7 98 7b 74 39 90  |d.^..7.2....{t9.|
+000002f0  fa d0 32 f3 fe 4d 01 6b  78 75 31 7e 67 4f 61 0f  |..2..M.kxu1~gOa.|
+00000300  bb c6 3e c0                                       |..>.|
+>>> Flow 4 (server to client)
+00000000  17 03 03 02 9b f5 b2 d6  62 fe e0 c8 8d cc 7a cd  |........b.....z.|
+00000010  29 51 b2 77 0d 9a 54 fb  43 6d f6 9c e1 ff 28 be  |)Q.w..T.Cm....(.|
+00000020  fc 50 68 80 2f 1c 4f 50  44 95 64 49 0a 66 fe 79  |.Ph./.OPD.dI.f.y|
+00000030  46 ba 88 e9 03 be 5c 91  60 84 78 03 a8 c6 21 90  |F.....\.`.x...!.|
+00000040  cd 79 de 2d 2f 81 dd 08  1f 52 1a 0e d8 69 16 22  |.y.-/....R...i."|
+00000050  a6 59 5b 2b 85 08 00 16  e7 85 bd 43 9a cc ce e6  |.Y[+.......C....|
+00000060  3a ee 70 25 0b 95 90 4b  c0 42 4a 48 25 d3 50 92  |:.p%...K.BJH%.P.|
+00000070  19 e1 3e b8 72 c5 a1 e8  dd 9f a4 57 2d b0 a6 24  |..>.r......W-..$|
+00000080  8b 8c 55 41 f3 26 45 dd  dd 2b d3 15 8d d9 ca e4  |..UA.&E..+......|
+00000090  15 6e b5 6d 99 79 ba 46  00 e6 5e 75 52 fd f9 26  |.n.m.y.F..^uR..&|
+000000a0  cf cd 69 cf be 29 a7 b9  7d 1b 1d 6b ab 17 ee 4e  |..i..)..}..k...N|
+000000b0  f5 24 b0 89 0f b5 c7 41  4e ea cd 32 98 47 23 bc  |.$.....AN..2.G#.|
+000000c0  91 03 b1 23 e0 5c 5e 37  40 95 da 90 ef eb 95 81  |...#.\^7@.......|
+000000d0  7b 2d c7 15 8f f8 2d ba  69 41 0e a9 eb 19 6c 6c  |{-....-.iA....ll|
+000000e0  73 b0 05 fc b9 f4 76 91  2b 6a 72 fa d6 e5 87 a9  |s.....v.+jr.....|
+000000f0  90 49 81 8c d5 fa 78 a2  a1 8f 77 c7 35 78 1b ba  |.I....x...w.5x..|
+00000100  ac 3c 41 51 ce 4e 99 c9  74 a0 bc 51 12 b5 15 2c  |.<AQ.N..t..Q...,|
+00000110  8e 36 6e e1 c9 bb 0f d2  fd 00 97 56 de 66 a9 19  |.6n........V.f..|
+00000120  c7 2f 18 e5 67 b4 34 73  9e b2 6f 68 26 8d 2f da  |./..g.4s..oh&./.|
+00000130  92 bd 52 13 32 3c 49 80  8c c7 3c 11 9d 9f 05 c0  |..R.2<I...<.....|
+00000140  aa 5d 63 33 8e 07 60 20  6a 01 1f 5a 16 45 4d ba  |.]c3..` j..Z.EM.|
+00000150  b0 2a 5c 26 b1 ea 26 72  59 c5 b0 59 8a 1a cb 9a  |.*\&..&rY..Y....|
+00000160  6a 54 55 06 75 37 a0 c9  04 4e 2f 61 de ef b5 df  |jTU.u7...N/a....|
+00000170  68 ae 42 03 29 91 e3 1d  a0 6b 18 4d 17 23 3d 61  |h.B.)....k.M.#=a|
+00000180  87 72 06 9f 45 98 0d 1e  f7 f1 f5 f3 f7 04 a5 98  |.r..E...........|
+00000190  29 c2 2e 77 d9 2c 95 df  5d 3d 20 41 36 26 1b 46  |)..w.,..]= A6&.F|
+000001a0  ea 54 9e a3 96 05 ba f7  33 01 85 b0 d1 9f 78 3c  |.T......3.....x<|
+000001b0  0f 73 0d 04 52 7f 02 f4  cb 79 f1 e2 d1 63 60 d6  |.s..R....y...c`.|
+000001c0  e1 34 05 23 79 c3 37 eb  d0 5b ea bc f4 f9 bb 7a  |.4.#y.7..[.....z|
+000001d0  85 9e 42 50 3c c8 f8 e6  f4 93 71 c2 6a 46 b9 26  |..BP<.....q.jF.&|
+000001e0  8c 17 b4 c9 65 00 fb 9a  d6 54 ab e6 71 c1 1b 5a  |....e....T..q..Z|
+000001f0  51 a2 6f df 0b 52 29 8c  c3 ec 8e bf 31 36 93 7e  |Q.o..R).....16.~|
+00000200  59 cc ca 49 71 dc ce 84  40 7d 43 81 5c 96 ed ca  |Y..Iq...@}C.\...|
+00000210  d1 e6 15 40 cf 19 f4 ed  61 28 9a e3 6b e7 1c 9b  |...@....a(..k...|
+00000220  c1 71 d0 46 ef 79 3b d8  35 e3 7b 47 3f a2 78 76  |.q.F.y;.5.{G?.xv|
+00000230  17 58 13 67 5f 4e f0 ed  2e e9 84 e1 92 0c a6 36  |.X.g_N.........6|
+00000240  5c 5b de 8e 5c 04 ed d4  a4 75 10 fd 85 9c e5 8e  |\[..\....u......|
+00000250  ca 02 14 fb 91 8b 85 14  79 e5 97 1f 63 46 48 90  |........y...cFH.|
+00000260  26 c7 2f a2 c0 18 71 d9  2e e3 81 78 7b 74 67 e0  |&./...q....x{tg.|
+00000270  e1 ef 48 af 41 96 9f 1a  44 d8 6c 94 49 3e 9b 47  |..H.A...D.l.I>.G|
+00000280  71 63 2f 0c 94 c9 42 ac  bc 4c 0a 16 fe 9a 90 eb  |qc/...B..L......|
+00000290  02 75 16 1a 10 23 b2 75  67 c7 c5 17 55 9b cf 69  |.u...#.ug...U..i|
+000002a0  17 03 03 00 1e 45 8c ed  99 0f 8a 83 d8 89 70 49  |.....E........pI|
+000002b0  17 a8 fd 2b 6e ef ff 53  fa 99 52 89 ee 8b 19 f1  |...+n..S..R.....|
+000002c0  41 09 30 17 03 03 00 13  14 f0 f6 ef c5 f9 52 15  |A.0...........R.|
+000002d0  77 de 5e 46 63 8d 3b 2f  07 84 aa                 |w.^Fc.;/...|
diff --git a/src/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled
new file mode 100644
index 0000000..c13db8d
--- /dev/null
+++ b/src/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled
@@ -0,0 +1,103 @@
+>>> Flow 1 (client to server)
+00000000  16 03 01 00 e0 01 00 00  dc 03 03 1e 9f 50 05 56  |.............P.V|
+00000010  a7 21 c8 df 56 a8 f3 bb  e4 15 3b b0 04 e5 f5 10  |.!..V.....;.....|
+00000020  d8 5b 0e 68 d3 b4 39 64  b5 89 9c 20 5a 6b 29 6d  |.[.h..9d... Zk)m|
+00000030  22 a0 e0 fb 7f 2d 87 48  e7 b4 c9 b3 5a d0 2b c7  |"....-.H....Z.+.|
+00000040  ad d8 e4 ad d5 eb 81 b3  1f 61 0e 65 00 08 13 02  |.........a.e....|
+00000050  13 03 13 01 00 ff 01 00  00 8b 00 00 00 0e 00 0c  |................|
+00000060  00 00 09 31 32 37 2e 30  2e 30 2e 31 00 0b 00 04  |...127.0.0.1....|
+00000070  03 00 01 02 00 0a 00 0c  00 0a 00 1d 00 17 00 1e  |................|
+00000080  00 19 00 18 00 16 00 00  00 17 00 00 00 0d 00 1e  |................|
+00000090  00 1c 04 03 05 03 06 03  08 07 08 08 08 09 08 0a  |................|
+000000a0  08 0b 08 04 08 05 08 06  04 01 05 01 06 01 00 2b  |...............+|
+000000b0  00 03 02 03 04 00 2d 00  02 01 01 00 33 00 26 00  |......-.....3.&.|
+000000c0  24 00 1d 00 20 ba 67 99  b3 60 71 ed 6c bb 8d 7e  |$... .g..`q.l..~|
+000000d0  4c c3 ea 37 6d 90 b6 f8  91 67 71 2c 84 a7 32 3a  |L..7m....gq,..2:|
+000000e0  23 2a 90 13 35                                    |#*..5|
+>>> Flow 2 (server to client)
+00000000  16 03 03 00 7a 02 00 00  76 03 03 00 00 00 00 00  |....z...v.......|
+00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+00000020  00 00 00 00 00 00 00 00  00 00 00 20 5a 6b 29 6d  |........... Zk)m|
+00000030  22 a0 e0 fb 7f 2d 87 48  e7 b4 c9 b3 5a d0 2b c7  |"....-.H....Z.+.|
+00000040  ad d8 e4 ad d5 eb 81 b3  1f 61 0e 65 13 02 00 00  |.........a.e....|
+00000050  2e 00 2b 00 02 03 04 00  33 00 24 00 1d 00 20 2f  |..+.....3.$... /|
+00000060  e5 7d a3 47 cd 62 43 15  28 da ac 5f bb 29 07 30  |.}.G.bC.(.._.).0|
+00000070  ff f6 84 af c4 cf c2 ed  90 99 5f 58 cb 3b 74 14  |.........._X.;t.|
+00000080  03 03 00 01 01 17 03 03  00 17 d9 74 68 ee e6 54  |...........th..T|
+00000090  e3 7a 0e ee 86 c7 a8 bb  c7 65 fc e4 c4 6c 58 7a  |.z.......e...lXz|
+000000a0  1e 17 03 03 02 6d 98 c3  0c cc 80 fe ea 70 13 4e  |.....m.......p.N|
+000000b0  2f f6 49 99 5f 27 0a f9  4d cf e5 1a 9a 37 fb e7  |/.I._'..M....7..|
+000000c0  3b a4 60 82 43 df fb fa  47 15 6f d8 db d2 3e c3  |;.`.C...G.o...>.|
+000000d0  dd a0 37 ca b2 b4 c9 1b  5c 86 4a e0 7e 06 1e 27  |..7.....\.J.~..'|
+000000e0  73 c6 cd 54 37 df 95 b1  c6 d5 44 85 2c 67 7d a7  |s..T7.....D.,g}.|
+000000f0  2a 7d 87 86 5e f3 e5 60  f8 7c de bf 78 89 35 9b  |*}..^..`.|..x.5.|
+00000100  d1 0b 8a dd 6f 40 d8 5a  55 10 e2 71 b0 7a 5e 4b  |....o@.ZU..q.z^K|
+00000110  86 18 be 18 a7 f8 8e c6  ae 8c 1e df bf 84 77 c5  |..............w.|
+00000120  dc b1 17 26 72 ea bb 9b  28 6c bf 19 8d 1a 22 90  |...&r...(l....".|
+00000130  0f 19 92 5b ff db 07 84  48 61 68 f0 50 20 76 a3  |...[....Hah.P v.|
+00000140  d3 f2 4a 3b 60 f5 73 cb  61 f7 11 63 f2 a7 0e 18  |..J;`.s.a..c....|
+00000150  30 96 d0 17 f1 2f 58 09  49 33 15 3e 31 e4 17 e8  |0..../X.I3.>1...|
+00000160  07 48 b5 43 06 40 60 4f  a0 78 0d 51 0c 3f 0f 1a  |.H.C.@`O.x.Q.?..|
+00000170  8c 95 7a 3e 36 66 36 22  dc 58 4e b7 3e 19 ad de  |..z>6f6".XN.>...|
+00000180  c9 f9 b0 76 e4 e2 8c 04  27 6f 67 8f fe 86 b9 41  |...v....'og....A|
+00000190  53 7d 9f d1 e0 a6 0b ec  fc c0 82 bf 00 36 28 4d  |S}...........6(M|
+000001a0  20 3a e3 42 67 87 16 64  6c 4f e2 54 23 d1 0f 32  | :.Bg..dlO.T#..2|
+000001b0  e9 16 9a da 46 a6 39 18  d5 6e a6 93 25 de a1 77  |....F.9..n..%..w|
+000001c0  d9 26 b5 7c b4 85 8a 69  48 90 11 a9 8c 42 ca b8  |.&.|...iH....B..|
+000001d0  88 63 df ec 6c e3 9f 2c  29 75 9b 57 79 8b 69 66  |.c..l..,)u.Wy.if|
+000001e0  16 9e 93 48 04 8a 41 e0  8b 0e fb a5 9c fd 68 f6  |...H..A.......h.|
+000001f0  5f ab 89 11 e4 aa 4c 6c  92 df b3 a3 39 f0 38 d9  |_.....Ll....9.8.|
+00000200  7d 1b 42 13 ee d1 83 e2  20 3f 60 81 96 d9 63 2c  |}.B..... ?`...c,|
+00000210  e8 54 a5 08 41 9b 1d 02  41 37 a2 ce 0c 9b 34 bf  |.T..A...A7....4.|
+00000220  43 c5 ac 90 67 cd 6b b6  55 31 36 b1 2b 0e ed 8c  |C...g.k.U16.+...|
+00000230  23 ae 71 b2 ab f3 94 68  f2 f6 87 d3 87 61 ca aa  |#.q....h.....a..|
+00000240  0b 65 63 a1 11 dc 6d 74  33 c8 24 a6 ae 40 27 c7  |.ec...mt3.$..@'.|
+00000250  d4 06 51 89 15 35 66 21  b0 82 15 87 70 c5 b8 8d  |..Q..5f!....p...|
+00000260  34 48 ff 41 e0 1a b0 46  f7 38 47 53 64 f7 a3 a2  |4H.A...F.8GSd...|
+00000270  61 96 72 ea 90 de 86 18  64 49 91 ed 97 05 e3 27  |a.r.....dI.....'|
+00000280  47 df ea 06 c6 28 f9 79  51 5e 64 b6 de 52 75 8a  |G....(.yQ^d..Ru.|
+00000290  79 8d 8e a6 d5 b0 f1 a6  ab 76 44 25 4b 80 5e e4  |y........vD%K.^.|
+000002a0  d4 aa c6 2d 77 1a 49 52  16 d6 73 6b 18 2d d1 a6  |...-w.IR..sk.-..|
+000002b0  4c e1 be 4d f8 79 34 a1  4c 81 88 9c 4b 85 f3 28  |L..M.y4.L...K..(|
+000002c0  97 fc 3a 7e cf d4 81 2c  d3 57 df 09 f5 49 f5 cf  |..:~...,.W...I..|
+000002d0  c7 7c 22 b3 8e 95 0f 97  6d d1 56 e3 43 7e 52 0f  |.|".....m.V.C~R.|
+000002e0  d4 da 3f e0 4e 06 b9 84  18 7d 7c 56 49 e0 d7 4a  |..?.N....}|VI..J|
+000002f0  d6 df c4 70 0c 74 5b 1f  4d 76 28 cd 3b b0 9e 27  |...p.t[.Mv(.;..'|
+00000300  cc 6b 1a 13 41 1a 6b bf  0d 2d 93 b2 d5 7e 7e 25  |.k..A.k..-...~~%|
+00000310  0e 8a 9c 17 03 03 00 99  df 4b 8e 3e d0 14 be 76  |.........K.>...v|
+00000320  f1 d3 ca b1 39 c0 7e 6c  4f 8c d9 0d b8 83 07 39  |....9.~lO......9|
+00000330  08 55 13 1e 3d 68 0f 99  9f 9a 68 1f 57 6a aa 41  |.U..=h....h.Wj.A|
+00000340  a4 40 2b 12 f2 4b 6c db  3c 59 fa 99 5c e2 c7 2d  |.@+..Kl.<Y..\..-|
+00000350  4b 55 4c 27 b1 6c bf 99  c3 36 1d 73 7a 8b fd bc  |KUL'.l...6.sz...|
+00000360  93 77 27 f5 9e cd 10 61  bc 8d b5 bf 7b bb 69 00  |.w'....a....{.i.|
+00000370  f9 f0 d3 22 dd 4e 7d 12  5a 61 49 1d d4 29 14 43  |...".N}.ZaI..).C|
+00000380  e5 62 ab d8 c6 78 75 80  4b 7a 6b 3f af 4b 92 2a  |.b...xu.Kzk?.K.*|
+00000390  23 29 da 85 c0 d7 35 03  9d ed 9c f7 83 39 cf cb  |#)....5......9..|
+000003a0  0f 85 5e 9f 29 61 d8 a2  d0 cb 14 2d 71 50 6f d5  |..^.)a.....-qPo.|
+000003b0  c2 17 03 03 00 45 be 9b  ee 5d e1 08 8a c2 d6 67  |.....E...].....g|
+000003c0  df 3b 84 50 28 30 69 bd  11 89 6a ab 02 ad d7 79  |.;.P(0i...j....y|
+000003d0  8b 2c 0a a9 9c ce e5 30  49 2d 59 82 e8 ee d3 03  |.,.....0I-Y.....|
+000003e0  77 d3 fc 22 dd 81 be e6  f4 22 36 8d 8e b1 7c 4a  |w.."....."6...|J|
+000003f0  b9 9c 6a ea 3f f0 aa ac  ec b6 c7 17 03 03 00 a3  |..j.?...........|
+00000400  69 e0 19 38 57 54 62 6c  28 d9 54 94 79 6e 7b 48  |i..8WTbl(.T.yn{H|
+00000410  25 55 7f 5f bb cc 91 07  30 47 55 9b f3 6e b9 ba  |%U._....0GU..n..|
+00000420  50 65 9b e9 81 5d 53 20  cd 27 5d ee 92 93 01 8f  |Pe...]S .'].....|
+00000430  5a d6 02 b9 26 1b 45 c3  40 26 6b 81 c3 ba 1e 3c  |Z...&.E.@&k....<|
+00000440  e6 03 93 b0 18 fe 2d be  07 97 b1 a1 a7 55 8f d8  |......-......U..|
+00000450  96 7a 58 ad 7d c1 72 71  d9 25 07 56 22 9a 7a f9  |.zX.}.rq.%.V".z.|
+00000460  4a 1b 82 30 e9 fb b0 26  81 45 d2 45 5b 1c 7d 97  |J..0...&.E.E[.}.|
+00000470  89 6d 17 69 81 27 a6 4c  be d0 78 1d b5 6c 3f 94  |.m.i.'.L..x..l?.|
+00000480  ef e4 6b ec 02 63 8b bf  f9 00 8a 8a 46 43 5d e0  |..k..c......FC].|
+00000490  52 38 8c d5 76 d7 79 42  a3 6b 35 e2 45 f3 0f b5  |R8..v.yB.k5.E...|
+000004a0  9f 22 f9                                          |.".|
+>>> Flow 3 (client to server)
+00000000  14 03 03 00 01 01 17 03  03 00 45 4b 7c c5 9e c6  |..........EK|...|
+00000010  47 4a 90 d8 c2 c0 49 f7  3b c4 26 eb 15 18 9c bc  |GJ....I.;.&.....|
+00000020  c8 44 f0 53 94 2f 0f c8  d7 c1 86 42 ed b7 8f 63  |.D.S./.....B...c|
+00000030  a0 97 5d 5b 15 01 3a 3d  ca a6 d0 1a a4 77 cc 7e  |..][..:=.....w.~|
+00000040  88 fd 0b c9 a0 46 b7 40  25 8a 03 6e 99 66 bb 84  |.....F.@%..n.f..|
+>>> Flow 4 (server to client)
+00000000  17 03 03 00 1e 6a 41 80  ca 72 5f c3 ee e1 88 49  |.....jA..r_....I|
+00000010  6d be a4 d9 26 07 5c 2b  2c a7 83 b5 c4 eb 4e 4b  |m...&.\+,.....NK|
+00000020  a1 29 98 17 03 03 00 13  2a f9 33 6c 46 f7 9a 51  |.)......*.3lF..Q|
+00000030  1b 36 cd bc d8 5d 94 0d  9e 4b 72                 |.6...]...Kr|
diff --git a/src/crypto/tls/tls.go b/src/crypto/tls/tls.go
index f8e32ab..578035c 100644
--- a/src/crypto/tls/tls.go
+++ b/src/crypto/tls/tls.go
@@ -4,6 +4,15 @@
 
 // Package tls partially implements TLS 1.2, as specified in RFC 5246,
 // and TLS 1.3, as specified in RFC 8446.
+//
+// TLS 1.3 is available only on an opt-in basis in Go 1.12. To enable
+// it, set the GODEBUG environment variable (comma-separated key=value
+// options) such that it includes "tls13=1". To enable it from within
+// the process, set the environment variable before any use of TLS:
+//
+//     func init() {
+//         os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1")
+//     }
 package tls
 
 // BUG(agl): The crypto/tls package only implements some countermeasures
diff --git a/src/crypto/tls/tls_test.go b/src/crypto/tls/tls_test.go
index 00bb6e4..208c13c 100644
--- a/src/crypto/tls/tls_test.go
+++ b/src/crypto/tls/tls_test.go
@@ -18,10 +18,22 @@
 	"os"
 	"reflect"
 	"strings"
+	"sync"
 	"testing"
 	"time"
 )
 
+var savedSupportedSignatureAlgorithmsTLS12 = supportedSignatureAlgorithmsTLS12
+
+func init() {
+	// TLS 1.3 is opt-in for Go 1.12, and RSA-PSS is disabled in TLS 1.2, but we
+	// want to run most tests with both enabled. TestTLS13Switch below and the
+	// "PSS-Disabled" recordings test the disabled behavior. See Issue 30055.
+	tls13Support.Do(func() {}) // defuse the sync.Once
+	tls13Support.cached = true
+	supportedSignatureAlgorithmsTLS12 = supportedSignatureAlgorithms
+}
+
 var rsaCertPEM = `-----BEGIN CERTIFICATE-----
 MIIB0zCCAX2gAwIBAgIJAI/M7BYjwB+uMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
 BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
@@ -1076,18 +1088,47 @@
 		VersionSSL30,
 	}
 
-	ss, cs, err := testHandshake(t, testConfig, testConfig)
+	expectVersion(t, testConfig, testConfig, VersionTLS12)
+}
+
+func expectVersion(t *testing.T, clientConfig, serverConfig *Config, v uint16) {
+	ss, cs, err := testHandshake(t, clientConfig, serverConfig)
 	if err != nil {
-		t.Fatalf("Handshake failed when support for TLS 1.3 was dropped: %v", err)
+		t.Fatalf("Handshake failed: %v", err)
 	}
-	if ss.Version != VersionTLS12 {
-		t.Errorf("Server negotiated version %x, expected %x", cs.Version, VersionTLS12)
+	if ss.Version != v {
+		t.Errorf("Server negotiated version %x, expected %x", cs.Version, v)
 	}
-	if cs.Version != VersionTLS12 {
-		t.Errorf("Client negotiated version %x, expected %x", cs.Version, VersionTLS12)
+	if cs.Version != v {
+		t.Errorf("Client negotiated version %x, expected %x", cs.Version, v)
 	}
 }
 
+// TestTLS13Switch checks the behavior of GODEBUG=tls13=[0|1]. See Issue 30055.
+func TestTLS13Switch(t *testing.T) {
+	defer func(savedGODEBUG string) {
+		os.Setenv("GODEBUG", savedGODEBUG)
+	}(os.Getenv("GODEBUG"))
+
+	os.Setenv("GODEBUG", "tls13=0")
+	tls13Support.Once = sync.Once{} // reset the cache
+
+	tls12Config := testConfig.Clone()
+	tls12Config.MaxVersion = VersionTLS12
+	expectVersion(t, testConfig, testConfig, VersionTLS12)
+	expectVersion(t, tls12Config, testConfig, VersionTLS12)
+	expectVersion(t, testConfig, tls12Config, VersionTLS12)
+	expectVersion(t, tls12Config, tls12Config, VersionTLS12)
+
+	os.Setenv("GODEBUG", "tls13=1")
+	tls13Support.Once = sync.Once{} // reset the cache
+
+	expectVersion(t, testConfig, testConfig, VersionTLS13)
+	expectVersion(t, tls12Config, testConfig, VersionTLS12)
+	expectVersion(t, testConfig, tls12Config, VersionTLS12)
+	expectVersion(t, tls12Config, tls12Config, VersionTLS12)
+}
+
 // Issue 28744: Ensure that we don't modify memory
 // that Config doesn't own such as Certificates.
 func TestBuildNameToCertificate_doesntModifyCertificates(t *testing.T) {
diff --git a/src/crypto/x509/cert_pool.go b/src/crypto/x509/cert_pool.go
index 7c55c3b..3e1e5fb 100644
--- a/src/crypto/x509/cert_pool.go
+++ b/src/crypto/x509/cert_pool.go
@@ -71,10 +71,15 @@
 	if s == nil {
 		return nil
 	}
+
+	var candidates []int
 	if len(cert.AuthorityKeyId) > 0 {
-		return s.bySubjectKeyId[string(cert.AuthorityKeyId)]
+		candidates = s.bySubjectKeyId[string(cert.AuthorityKeyId)]
 	}
-	return s.byName[string(cert.RawIssuer)]
+	if len(candidates) == 0 {
+		candidates = s.byName[string(cert.RawIssuer)]
+	}
+	return candidates
 }
 
 func (s *CertPool) contains(cert *Certificate) bool {
diff --git a/src/crypto/x509/verify_test.go b/src/crypto/x509/verify_test.go
index 85f4703..86fe76a 100644
--- a/src/crypto/x509/verify_test.go
+++ b/src/crypto/x509/verify_test.go
@@ -386,6 +386,19 @@
 
 		errorCallback: expectHostnameError("not valid for any names"),
 	},
+	{
+		// A certificate with an AKID should still chain to a parent without SKID.
+		// See Issue 30079.
+		leaf:        leafWithAKID,
+		roots:       []string{rootWithoutSKID},
+		currentTime: 1550000000,
+		dnsName:     "example",
+		systemSkip:  true,
+
+		expectedChains: [][]string{
+			{"Acme LLC", "Acme Co"},
+		},
+	},
 }
 
 func expectHostnameError(msg string) func(*testing.T, int, error) bool {
@@ -1679,6 +1692,109 @@
 -----END CERTIFICATE-----
 `
 
+const (
+	rootWithoutSKID = `
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            78:29:2a:dc:2f:12:39:7f:c9:33:93:ea:61:39:7d:70
+        Signature Algorithm: ecdsa-with-SHA256
+        Issuer: O = Acme Co
+        Validity
+            Not Before: Feb  4 22:56:34 2019 GMT
+            Not After : Feb  1 22:56:34 2029 GMT
+        Subject: O = Acme Co
+        Subject Public Key Info:
+            Public Key Algorithm: id-ecPublicKey
+                Public-Key: (256 bit)
+                pub:
+                    04:84:a6:8c:69:53:af:87:4b:39:64:fe:04:24:e6:
+                    d8:fc:d6:46:39:35:0e:92:dc:48:08:7e:02:5f:1e:
+                    07:53:5c:d9:e0:56:c5:82:07:f6:a3:e2:ad:f6:ad:
+                    be:a0:4e:03:87:39:67:0c:9c:46:91:68:6b:0e:8e:
+                    f8:49:97:9d:5b
+                ASN1 OID: prime256v1
+                NIST CURVE: P-256
+        X509v3 extensions:
+            X509v3 Key Usage: critical
+                Digital Signature, Key Encipherment, Certificate Sign
+            X509v3 Extended Key Usage:
+                TLS Web Server Authentication
+            X509v3 Basic Constraints: critical
+                CA:TRUE
+            X509v3 Subject Alternative Name:
+                DNS:example
+    Signature Algorithm: ecdsa-with-SHA256
+         30:46:02:21:00:c6:81:61:61:42:8d:37:e7:d0:c3:72:43:44:
+         17:bd:84:ff:88:81:68:9a:99:08:ab:3c:3a:c0:1e:ea:8c:ba:
+         c0:02:21:00:de:c9:fa:e5:5e:c6:e2:db:23:64:43:a9:37:42:
+         72:92:7f:6e:89:38:ea:9e:2a:a7:fd:2f:ea:9a:ff:20:21:e7
+-----BEGIN CERTIFICATE-----
+MIIBbzCCARSgAwIBAgIQeCkq3C8SOX/JM5PqYTl9cDAKBggqhkjOPQQDAjASMRAw
+DgYDVQQKEwdBY21lIENvMB4XDTE5MDIwNDIyNTYzNFoXDTI5MDIwMTIyNTYzNFow
+EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABISm
+jGlTr4dLOWT+BCTm2PzWRjk1DpLcSAh+Al8eB1Nc2eBWxYIH9qPirfatvqBOA4c5
+ZwycRpFoaw6O+EmXnVujTDBKMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr
+BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MBIGA1UdEQQLMAmCB2V4YW1wbGUwCgYI
+KoZIzj0EAwIDSQAwRgIhAMaBYWFCjTfn0MNyQ0QXvYT/iIFompkIqzw6wB7qjLrA
+AiEA3sn65V7G4tsjZEOpN0Jykn9uiTjqniqn/S/qmv8gIec=
+-----END CERTIFICATE-----
+`
+	leafWithAKID = `
+	Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            f0:8a:62:f0:03:84:a2:cf:69:63:ad:71:3b:b6:5d:8c
+        Signature Algorithm: ecdsa-with-SHA256
+        Issuer: O = Acme Co
+        Validity
+            Not Before: Feb  4 23:06:52 2019 GMT
+            Not After : Feb  1 23:06:52 2029 GMT
+        Subject: O = Acme LLC
+        Subject Public Key Info:
+            Public Key Algorithm: id-ecPublicKey
+                Public-Key: (256 bit)
+                pub:
+                    04:5a:4e:4d:fb:ff:17:f7:b6:13:e8:29:45:34:81:
+                    39:ff:8c:9c:d9:8c:0a:9f:dd:b5:97:4c:2b:20:91:
+                    1c:4f:6b:be:53:27:66:ec:4a:ad:08:93:6d:66:36:
+                    0c:02:70:5d:01:ca:7f:c3:29:e9:4f:00:ba:b4:14:
+                    ec:c5:c3:34:b3
+                ASN1 OID: prime256v1
+                NIST CURVE: P-256
+        X509v3 extensions:
+            X509v3 Key Usage: critical
+                Digital Signature, Key Encipherment
+            X509v3 Extended Key Usage:
+                TLS Web Server Authentication
+            X509v3 Basic Constraints: critical
+                CA:FALSE
+            X509v3 Authority Key Identifier:
+                keyid:C2:2B:5F:91:78:34:26:09:42:8D:6F:51:B2:C5:AF:4C:0B:DE:6A:42
+
+            X509v3 Subject Alternative Name:
+                DNS:example
+    Signature Algorithm: ecdsa-with-SHA256
+         30:44:02:20:64:e0:ba:56:89:63:ce:22:5e:4f:22:15:fd:3c:
+         35:64:9a:3a:6b:7b:9a:32:a0:7f:f7:69:8c:06:f0:00:58:b8:
+         02:20:09:e4:9f:6d:8b:9e:38:e1:b6:01:d5:ee:32:a4:94:65:
+         93:2a:78:94:bb:26:57:4b:c7:dd:6c:3d:40:2b:63:90
+-----BEGIN CERTIFICATE-----
+MIIBjTCCATSgAwIBAgIRAPCKYvADhKLPaWOtcTu2XYwwCgYIKoZIzj0EAwIwEjEQ
+MA4GA1UEChMHQWNtZSBDbzAeFw0xOTAyMDQyMzA2NTJaFw0yOTAyMDEyMzA2NTJa
+MBMxETAPBgNVBAoTCEFjbWUgTExDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
+Wk5N+/8X97YT6ClFNIE5/4yc2YwKn921l0wrIJEcT2u+Uydm7EqtCJNtZjYMAnBd
+Acp/wynpTwC6tBTsxcM0s6NqMGgwDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoG
+CCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUwitfkXg0JglCjW9R
+ssWvTAveakIwEgYDVR0RBAswCYIHZXhhbXBsZTAKBggqhkjOPQQDAgNHADBEAiBk
+4LpWiWPOIl5PIhX9PDVkmjpre5oyoH/3aYwG8ABYuAIgCeSfbYueOOG2AdXuMqSU
+ZZMqeJS7JldLx91sPUArY5A=
+-----END CERTIFICATE-----
+`
+)
+
 var unknownAuthorityErrorTests = []struct {
 	cert     string
 	expected string
diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go
index 08681a6..58098ad 100644
--- a/src/crypto/x509/x509.go
+++ b/src/crypto/x509/x509.go
@@ -2272,21 +2272,25 @@
 
 	Subject pkix.Name
 
-	// Attributes is the dried husk of a bug and shouldn't be used.
+	// Attributes contains the CSR attributes that can parse as
+	// pkix.AttributeTypeAndValueSET.
+	//
+	// Deprecated: use Extensions and ExtraExtensions instead for parsing and
+	// generating the requestedExtensions attribute.
 	Attributes []pkix.AttributeTypeAndValueSET
 
-	// Extensions contains raw X.509 extensions. When parsing CSRs, this
-	// can be used to extract extensions that are not parsed by this
+	// Extensions contains all requested extensions, in raw form. When parsing
+	// CSRs, this can be used to extract extensions that are not parsed by this
 	// package.
 	Extensions []pkix.Extension
 
-	// ExtraExtensions contains extensions to be copied, raw, into any
-	// marshaled CSR. Values override any extensions that would otherwise
-	// be produced based on the other fields but are overridden by any
-	// extensions specified in Attributes.
+	// ExtraExtensions contains extensions to be copied, raw, into any CSR
+	// marshaled by CreateCertificateRequest. Values override any extensions
+	// that would otherwise be produced based on the other fields but are
+	// overridden by any extensions specified in Attributes.
 	//
-	// The ExtraExtensions field is not populated when parsing CSRs, see
-	// Extensions.
+	// The ExtraExtensions field is not populated by ParseCertificateRequest,
+	// see Extensions instead.
 	ExtraExtensions []pkix.Extension
 
 	// Subject Alternate Name values.
@@ -2385,21 +2389,21 @@
 // CreateCertificateRequest creates a new certificate request based on a
 // template. The following members of template are used:
 //
-//  - Attributes
-//  - DNSNames
-//  - EmailAddresses
-//  - ExtraExtensions
-//  - IPAddresses
-//  - URIs
 //  - SignatureAlgorithm
 //  - Subject
+//  - DNSNames
+//  - EmailAddresses
+//  - IPAddresses
+//  - URIs
+//  - ExtraExtensions
+//  - Attributes (deprecated)
 //
-// The private key is the private key of the signer.
+// priv is the private key to sign the CSR with, and the corresponding public
+// key will be included in the CSR. It must implement crypto.Signer and its
+// Public() method must return a *rsa.PublicKey or a *ecdsa.PublicKey. (A
+// *rsa.PrivateKey or *ecdsa.PrivateKey satisfies this.)
 //
 // The returned slice is the certificate request in DER encoding.
-//
-// All keys types that are implemented via crypto.Signer are supported (This
-// includes *rsa.PublicKey and *ecdsa.PublicKey.)
 func CreateCertificateRequest(rand io.Reader, template *CertificateRequest, priv interface{}) (csr []byte, err error) {
 	key, ok := priv.(crypto.Signer)
 	if !ok {
diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go
index 5ff2bc9..ecc6547 100644
--- a/src/database/sql/driver/driver.go
+++ b/src/database/sql/driver/driver.go
@@ -137,7 +137,7 @@
 
 // Execer is an optional interface that may be implemented by a Conn.
 //
-// If a Conn implements neither ExecerContext nor Execer Execer,
+// If a Conn implements neither ExecerContext nor Execer,
 // the sql package's DB.Exec will first prepare a query, execute the statement,
 // and then close the statement.
 //
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go
index b0353ab..8cdc903 100644
--- a/src/database/sql/sql.go
+++ b/src/database/sql/sql.go
@@ -1698,7 +1698,7 @@
 		}
 	}
 	if err == driver.ErrBadConn {
-		dc, err = db.conn(ctx, cachedOrNewConn)
+		dc, err = db.conn(ctx, alwaysNewConn)
 	}
 	if err != nil {
 		return nil, err
@@ -2256,6 +2256,13 @@
 
 // Stmt is a prepared statement.
 // A Stmt is safe for concurrent use by multiple goroutines.
+//
+// If a Stmt is prepared on a Tx or Conn, it will be bound to a single
+// underlying connection forever. If the Tx or Conn closes, the Stmt will
+// become unusable and all operations will return an error.
+// If a Stmt is prepared on a DB, it will remain usable for the lifetime of the
+// DB. When the Stmt needs to execute on a new underlying connection, it will
+// prepare itself on the new connection automatically.
 type Stmt struct {
 	// Immutable:
 	db        *DB    // where we came from
diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
index f10124e..dea63f1 100644
--- a/src/encoding/json/encode.go
+++ b/src/encoding/json/encode.go
@@ -259,6 +259,7 @@
 	return "json: invalid UTF-8 in string: " + strconv.Quote(e.S)
 }
 
+// A MarshalerError represents an error from calling a MarshalJSON or MarshalText method.
 type MarshalerError struct {
 	Type reflect.Type
 	Err  error
diff --git a/src/flag/flag.go b/src/flag/flag.go
index 2eef9d6..c312c62 100644
--- a/src/flag/flag.go
+++ b/src/flag/flag.go
@@ -548,6 +548,8 @@
 // the output will be
 //	-I directory
 //		search directory for include files.
+//
+// To change the destination for flag messages, call CommandLine.SetOutput.
 func PrintDefaults() {
 	CommandLine.PrintDefaults()
 }
diff --git a/src/internal/fmtsort/sort.go b/src/internal/fmtsort/sort.go
index c959cbe..70a305a 100644
--- a/src/internal/fmtsort/sort.go
+++ b/src/internal/fmtsort/sort.go
@@ -167,7 +167,7 @@
 		if c, ok := nilCompare(aVal, bVal); ok {
 			return c
 		}
-		c := compare(reflect.ValueOf(aType), reflect.ValueOf(bType))
+		c := compare(reflect.ValueOf(aVal.Elem().Type()), reflect.ValueOf(bVal.Elem().Type()))
 		if c != 0 {
 			return c
 		}
diff --git a/src/internal/fmtsort/sort_test.go b/src/internal/fmtsort/sort_test.go
index 6b10c77..e060d4b 100644
--- a/src/internal/fmtsort/sort_test.go
+++ b/src/internal/fmtsort/sort_test.go
@@ -126,10 +126,6 @@
 		map[[2]int]string{{7, 2}: "72", {7, 1}: "71", {3, 4}: "34"},
 		"[3 4]:34 [7 1]:71 [7 2]:72",
 	},
-	{
-		map[interface{}]string{7: "7", 4: "4", 3: "3", nil: "nil"},
-		"<nil>:nil 3:3 4:4 7:7",
-	},
 }
 
 func sprint(data interface{}) string {
@@ -210,3 +206,41 @@
 		}
 	}
 }
+
+func TestInterface(t *testing.T) {
+	// A map containing multiple concrete types should be sorted by type,
+	// then value. However, the relative ordering of types is unspecified,
+	// so test this by checking the presence of sorted subgroups.
+	m := map[interface{}]string{
+		[2]int{1, 0}:             "",
+		[2]int{0, 1}:             "",
+		true:                     "",
+		false:                    "",
+		3.1:                      "",
+		2.1:                      "",
+		1.1:                      "",
+		math.NaN():               "",
+		3:                        "",
+		2:                        "",
+		1:                        "",
+		"c":                      "",
+		"b":                      "",
+		"a":                      "",
+		struct{ x, y int }{1, 0}: "",
+		struct{ x, y int }{0, 1}: "",
+	}
+	got := sprint(m)
+	typeGroups := []string{
+		"NaN: 1.1: 2.1: 3.1:", // float64
+		"false: true:",        // bool
+		"1: 2: 3:",            // int
+		"a: b: c:",            // string
+		"[0 1]: [1 0]:",       // [2]int
+		"{0 1}: {1 0}:",       // struct{ x int; y int }
+	}
+	for _, g := range typeGroups {
+		if !strings.Contains(got, g) {
+			t.Errorf("sorted map should contain %q", g)
+		}
+	}
+}
diff --git a/src/internal/poll/fd_windows.go b/src/internal/poll/fd_windows.go
index 19d9a12..f860b82 100644
--- a/src/internal/poll/fd_windows.go
+++ b/src/internal/poll/fd_windows.go
@@ -660,6 +660,10 @@
 		return 0, err
 	}
 	defer fd.writeUnlock()
+	if fd.isFile || fd.isDir || fd.isConsole {
+		fd.l.Lock()
+		defer fd.l.Unlock()
+	}
 
 	ntotal := 0
 	for len(buf) > 0 {
@@ -670,8 +674,6 @@
 		var n int
 		var err error
 		if fd.isFile || fd.isDir || fd.isConsole {
-			fd.l.Lock()
-			defer fd.l.Unlock()
 			if fd.isConsole {
 				n, err = fd.writeConsole(b)
 			} else {
diff --git a/src/math/big/ratconv.go b/src/math/big/ratconv.go
index 157d8d0..5656280 100644
--- a/src/math/big/ratconv.go
+++ b/src/math/big/ratconv.go
@@ -38,8 +38,8 @@
 }
 
 // SetString sets z to the value of s and returns z and a boolean indicating
-// success. s can be given as a fraction "a/b" or as a floating-point number
-// optionally followed by an exponent. The entire string (not just a prefix)
+// success. s can be given as a fraction "a/b" or as a decimal floating-point
+// number optionally followed by an exponent. The entire string (not just a prefix)
 // must be valid for success. If the operation failed, the value of z is
 // undefined but the returned value is nil.
 func (z *Rat) SetString(s string) (*Rat, bool) {
@@ -78,6 +78,7 @@
 	}
 
 	// mantissa
+	// TODO(gri) allow other bases besides 10 for mantissa and exponent? (issue #29799)
 	var ecorr int
 	z.a.abs, _, ecorr, err = z.a.abs.scan(r, 10, true)
 	if err != nil {
diff --git a/src/net/http/client.go b/src/net/http/client.go
index ea6c071..921f86b 100644
--- a/src/net/http/client.go
+++ b/src/net/http/client.go
@@ -478,10 +478,10 @@
 // error.
 //
 // If the returned error is nil, the Response will contain a non-nil
-// Body which the user is expected to close. If the Body is not
-// closed, the Client's underlying RoundTripper (typically Transport)
-// may not be able to re-use a persistent TCP connection to the server
-// for a subsequent "keep-alive" request.
+// Body which the user is expected to close. If the Body is not both
+// read to EOF and closed, the Client's underlying RoundTripper
+// (typically Transport) may not be able to re-use a persistent TCP
+// connection to the server for a subsequent "keep-alive" request.
 //
 // The request Body, if non-nil, will be closed by the underlying
 // Transport, even on errors.
diff --git a/src/net/http/fs_test.go b/src/net/http/fs_test.go
index 255d215..762e88b 100644
--- a/src/net/http/fs_test.go
+++ b/src/net/http/fs_test.go
@@ -583,16 +583,23 @@
 	ts := httptest.NewServer(FileServer(Dir(".")))
 	defer ts.Close()
 
-	res, err := Get(ts.URL + "/..\x00")
+	c, err := net.Dial("tcp", ts.Listener.Addr().String())
 	if err != nil {
 		t.Fatal(err)
 	}
-	b, err := ioutil.ReadAll(res.Body)
+	defer c.Close()
+	_, err = fmt.Fprintf(c, "GET /..\x00 HTTP/1.0\r\n\r\n")
 	if err != nil {
-		t.Fatal("reading Body:", err)
+		t.Fatal(err)
+	}
+	var got bytes.Buffer
+	bufr := bufio.NewReader(io.TeeReader(c, &got))
+	res, err := ReadResponse(bufr, nil)
+	if err != nil {
+		t.Fatal("ReadResponse: ", err)
 	}
 	if res.StatusCode == 200 {
-		t.Errorf("got status 200; want an error. Body is:\n%s", string(b))
+		t.Errorf("got status 200; want an error. Body is:\n%s", got.Bytes())
 	}
 }
 
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index 676eebd..f714cbb 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -4852,7 +4852,7 @@
 
 // processFrameFromReader processes the serve loop's read from readFrameCh from the
 // frame-reading goroutine.
-// processFrameFromReader reports whether the connection should be kept open.
+// processFrameFromReader returns whether the connection should be kept open.
 func (sc *http2serverConn) processFrameFromReader(res http2readFrameResult) bool {
 	sc.serveG.check()
 	err := res.err
@@ -5157,12 +5157,6 @@
 		// type PROTOCOL_ERROR."
 		return http2ConnectionError(http2ErrCodeProtocol)
 	}
-	// RFC 7540, sec 6.1: If a DATA frame is received whose stream is not in
-	// "open" or "half-closed (local)" state, the recipient MUST respond with a
-	// stream error (Section 5.4.2) of type STREAM_CLOSED.
-	if state == http2stateClosed {
-		return http2streamError(id, http2ErrCodeStreamClosed)
-	}
 	if st == nil || state != http2stateOpen || st.gotTrailerHeader || st.resetQueued {
 		// This includes sending a RST_STREAM if the stream is
 		// in stateHalfClosedLocal (which currently means that
diff --git a/src/net/http/http.go b/src/net/http/http.go
index 624b2cf..e5d59e1 100644
--- a/src/net/http/http.go
+++ b/src/net/http/http.go
@@ -59,6 +59,17 @@
 	return true
 }
 
+// stringContainsCTLByte reports whether s contains any ASCII control character.
+func stringContainsCTLByte(s string) bool {
+	for i := 0; i < len(s); i++ {
+		b := s[i]
+		if b < ' ' || b == 0x7f {
+			return true
+		}
+	}
+	return false
+}
+
 func hexEscapeNonASCII(s string) string {
 	newLen := 0
 	for i := 0; i < len(s); i++ {
diff --git a/src/net/http/httptrace/trace.go b/src/net/http/httptrace/trace.go
index 3a62741..8b377ed 100644
--- a/src/net/http/httptrace/trace.go
+++ b/src/net/http/httptrace/trace.go
@@ -152,7 +152,7 @@
 	WroteHeaders func()
 
 	// Wait100Continue is called if the Request specified
-	// "Expected: 100-continue" and the Transport has written the
+	// "Expect: 100-continue" and the Transport has written the
 	// request headers but is waiting for "100 Continue" from the
 	// server before writing the request body.
 	Wait100Continue func()
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go
index 4e10bf3..4b165d6 100644
--- a/src/net/http/httputil/reverseproxy.go
+++ b/src/net/http/httputil/reverseproxy.go
@@ -389,6 +389,11 @@
 				latency: flushInterval,
 			}
 			defer mlw.stop()
+
+			// set up initial timer so headers get flushed even if body writes are delayed
+			mlw.flushPending = true
+			mlw.t = time.AfterFunc(flushInterval, mlw.delayedFlush)
+
 			dst = mlw
 		}
 	}
diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go
index 5edefa0..367ba73 100644
--- a/src/net/http/httputil/reverseproxy_test.go
+++ b/src/net/http/httputil/reverseproxy_test.go
@@ -9,6 +9,7 @@
 import (
 	"bufio"
 	"bytes"
+	"context"
 	"errors"
 	"fmt"
 	"io"
@@ -317,6 +318,47 @@
 	}
 }
 
+func TestReverseProxyFlushIntervalHeaders(t *testing.T) {
+	const expected = "hi"
+	stopCh := make(chan struct{})
+	backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		w.Header().Add("MyHeader", expected)
+		w.WriteHeader(200)
+		w.(http.Flusher).Flush()
+		<-stopCh
+	}))
+	defer backend.Close()
+	defer close(stopCh)
+
+	backendURL, err := url.Parse(backend.URL)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	proxyHandler := NewSingleHostReverseProxy(backendURL)
+	proxyHandler.FlushInterval = time.Microsecond
+
+	frontend := httptest.NewServer(proxyHandler)
+	defer frontend.Close()
+
+	req, _ := http.NewRequest("GET", frontend.URL, nil)
+	req.Close = true
+
+	ctx, cancel := context.WithTimeout(req.Context(), 10*time.Second)
+	defer cancel()
+	req = req.WithContext(ctx)
+
+	res, err := frontend.Client().Do(req)
+	if err != nil {
+		t.Fatalf("Get: %v", err)
+	}
+	defer res.Body.Close()
+
+	if res.Header.Get("MyHeader") != expected {
+		t.Errorf("got header %q; expected %q", res.Header.Get("MyHeader"), expected)
+	}
+}
+
 func TestReverseProxyCancelation(t *testing.T) {
 	const backendResponse = "I am the backend"
 
diff --git a/src/net/http/request.go b/src/net/http/request.go
index fb058f9..dcad2b6 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -550,7 +550,12 @@
 			ruri = r.URL.Opaque
 		}
 	}
-	// TODO(bradfitz): escape at least newlines in ruri?
+	if stringContainsCTLByte(ruri) {
+		return errors.New("net/http: can't write control character in Request.URL")
+	}
+	// TODO: validate r.Method too? At least it's less likely to
+	// come from an attacker (more likely to be a constant in
+	// code).
 
 	// Wrap the writer in a bufio Writer if it's not already buffered.
 	// Don't always call NewWriter, as that forces a bytes.Buffer
diff --git a/src/net/http/requestwrite_test.go b/src/net/http/requestwrite_test.go
index 7dbf0d4..b110b57 100644
--- a/src/net/http/requestwrite_test.go
+++ b/src/net/http/requestwrite_test.go
@@ -576,6 +576,17 @@
 			"User-Agent: Go-http-client/1.1\r\n" +
 			"X-Foo: X-Bar\r\n\r\n",
 	},
+
+	25: {
+		Req: Request{
+			Method: "GET",
+			URL: &url.URL{
+				Host:     "www.example.com",
+				RawQuery: "new\nline", // or any CTL
+			},
+		},
+		WantError: errors.New("net/http: can't write control character in Request.URL"),
+	},
 }
 
 func TestRequestWrite(t *testing.T) {
diff --git a/src/net/lookup.go b/src/net/lookup.go
index e108893..08e8d01 100644
--- a/src/net/lookup.go
+++ b/src/net/lookup.go
@@ -262,8 +262,9 @@
 	// only the values in context. See Issue 28600.
 	lookupGroupCtx, lookupGroupCancel := context.WithCancel(withUnexpiredValuesPreserved(ctx))
 
+	lookupKey := network + "\000" + host
 	dnsWaitGroup.Add(1)
-	ch, called := r.getLookupGroup().DoChan(host, func() (interface{}, error) {
+	ch, called := r.getLookupGroup().DoChan(lookupKey, func() (interface{}, error) {
 		defer dnsWaitGroup.Done()
 		return testHookLookupIP(lookupGroupCtx, resolverFunc, network, host)
 	})
@@ -280,7 +281,7 @@
 		// let the lookup continue uncanceled, and let later
 		// lookups with the same key share the result.
 		// See issues 8602, 20703, 22724.
-		if r.getLookupGroup().ForgetUnshared(host) {
+		if r.getLookupGroup().ForgetUnshared(lookupKey) {
 			lookupGroupCancel()
 		} else {
 			go func() {
diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go
index 5a6f7ea..871e17a 100644
--- a/src/net/lookup_test.go
+++ b/src/net/lookup_test.go
@@ -16,6 +16,7 @@
 	"sort"
 	"strings"
 	"sync"
+	"sync/atomic"
 	"testing"
 	"time"
 )
@@ -207,6 +208,9 @@
 }
 
 func TestLookupGmailTXT(t *testing.T) {
+	if runtime.GOOS == "plan9" {
+		t.Skip("skipping on plan9; see https://golang.org/issue/29722")
+	}
 	t.Parallel()
 	mustHaveExternalNetwork(t)
 
@@ -237,22 +241,24 @@
 		if len(txts) == 0 {
 			t.Error("got no record")
 		}
+		found := false
 		for _, txt := range txts {
-			if !strings.Contains(txt, tt.txt) || (!strings.HasSuffix(txt, tt.host) && !strings.HasSuffix(txt, tt.host+".")) {
-				t.Errorf("got %s; want a record containing %s, %s", txt, tt.txt, tt.host)
+			if strings.Contains(txt, tt.txt) && (strings.HasSuffix(txt, tt.host) || strings.HasSuffix(txt, tt.host+".")) {
+				found = true
+				break
 			}
 		}
+		if !found {
+			t.Errorf("got %v; want a record containing %s, %s", txts, tt.txt, tt.host)
+		}
 	}
 }
 
-var lookupGooglePublicDNSAddrTests = []struct {
-	addr, name string
-}{
-	{"8.8.8.8", ".google.com."},
-	{"8.8.4.4", ".google.com."},
-
-	{"2001:4860:4860::8888", ".google.com."},
-	{"2001:4860:4860::8844", ".google.com."},
+var lookupGooglePublicDNSAddrTests = []string{
+	"8.8.8.8",
+	"8.8.4.4",
+	"2001:4860:4860::8888",
+	"2001:4860:4860::8844",
 }
 
 func TestLookupGooglePublicDNSAddr(t *testing.T) {
@@ -264,8 +270,8 @@
 
 	defer dnsWaitGroup.Wait()
 
-	for _, tt := range lookupGooglePublicDNSAddrTests {
-		names, err := LookupAddr(tt.addr)
+	for _, ip := range lookupGooglePublicDNSAddrTests {
+		names, err := LookupAddr(ip)
 		if err != nil {
 			t.Fatal(err)
 		}
@@ -273,8 +279,8 @@
 			t.Error("got no record")
 		}
 		for _, name := range names {
-			if !strings.HasSuffix(name, tt.name) {
-				t.Errorf("got %s; want a record containing %s", name, tt.name)
+			if !strings.HasSuffix(name, ".google.com.") && !strings.HasSuffix(name, ".google.") {
+				t.Errorf("got %q; want a record ending in .google.com. or .google.", name)
 			}
 		}
 	}
@@ -650,8 +656,8 @@
 		t.Errorf("LookupAddr(8.8.8.8): %v (mode=%v)", err, mode)
 	} else {
 		for _, name := range names {
-			if !strings.HasSuffix(name, ".google.com.") {
-				t.Errorf("LookupAddr(8.8.8.8) = %v, want names ending in .google.com. with trailing dot (mode=%v)", names, mode)
+			if !strings.HasSuffix(name, ".google.com.") && !strings.HasSuffix(name, ".google.") {
+				t.Errorf("LookupAddr(8.8.8.8) = %v, want names ending in .google.com or .google with trailing dot (mode=%v)", names, mode)
 				break
 			}
 		}
@@ -1097,6 +1103,69 @@
 	}
 }
 
+// Issue 30521: The lookup group should call the resolver for each network.
+func TestLookupIPAddrConcurrentCallsForNetworks(t *testing.T) {
+	origTestHookLookupIP := testHookLookupIP
+	defer func() { testHookLookupIP = origTestHookLookupIP }()
+
+	queries := [][]string{
+		{"udp", "golang.org"},
+		{"udp4", "golang.org"},
+		{"udp6", "golang.org"},
+		{"udp", "golang.org"},
+		{"udp", "golang.org"},
+	}
+	results := map[[2]string][]IPAddr{
+		{"udp", "golang.org"}: {
+			{IP: IPv4(127, 0, 0, 1)},
+			{IP: IPv6loopback},
+		},
+		{"udp4", "golang.org"}: {
+			{IP: IPv4(127, 0, 0, 1)},
+		},
+		{"udp6", "golang.org"}: {
+			{IP: IPv6loopback},
+		},
+	}
+	calls := int32(0)
+	waitCh := make(chan struct{})
+	testHookLookupIP = func(ctx context.Context, fn func(context.Context, string, string) ([]IPAddr, error), network, host string) ([]IPAddr, error) {
+		// We'll block until this is called one time for each different
+		// expected result. This will ensure that the lookup group would wait
+		// for the existing call if it was to be reused.
+		if atomic.AddInt32(&calls, 1) == int32(len(results)) {
+			close(waitCh)
+		}
+		select {
+		case <-waitCh:
+		case <-ctx.Done():
+			return nil, ctx.Err()
+		}
+		return results[[2]string{network, host}], nil
+	}
+
+	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+	defer cancel()
+	wg := sync.WaitGroup{}
+	for _, q := range queries {
+		network := q[0]
+		host := q[1]
+		wg.Add(1)
+		go func() {
+			defer wg.Done()
+			gotIPs, err := DefaultResolver.lookupIPAddr(ctx, network, host)
+			if err != nil {
+				t.Errorf("lookupIPAddr(%v, %v): unexpected error: %v", network, host, err)
+			}
+			wantIPs := results[[2]string{network, host}]
+			if !reflect.DeepEqual(gotIPs, wantIPs) {
+				t.Errorf("lookupIPAddr(%v, %v): mismatched IPAddr results\n\tGot: %v\n\tWant: %v", network, host, gotIPs, wantIPs)
+			}
+		}()
+	}
+	wg.Wait()
+}
+
 func TestWithUnexpiredValuesPreserved(t *testing.T) {
 	ctx, cancel := context.WithCancel(context.Background())
 
diff --git a/src/net/net_test.go b/src/net/net_test.go
index 1cc8547..715db51 100644
--- a/src/net/net_test.go
+++ b/src/net/net_test.go
@@ -558,7 +558,7 @@
 	server := func(cs *TCPConn) error {
 		cs.SetLinger(0)
 		// Give the client time to get stuck in a Read.
-		time.Sleep(20 * time.Millisecond)
+		time.Sleep(50 * time.Millisecond)
 		cs.Close()
 		return nil
 	}
diff --git a/src/net/url/url.go b/src/net/url/url.go
index d84c95a..64274a0 100644
--- a/src/net/url/url.go
+++ b/src/net/url/url.go
@@ -513,6 +513,10 @@
 	var rest string
 	var err error
 
+	if stringContainsCTLByte(rawurl) {
+		return nil, errors.New("net/url: invalid control character in URL")
+	}
+
 	if rawurl == "" && viaRequest {
 		return nil, errors.New("empty url")
 	}
@@ -1134,3 +1138,14 @@
 	}
 	return true
 }
+
+// stringContainsCTLByte reports whether s contains any ASCII control character.
+func stringContainsCTLByte(s string) bool {
+	for i := 0; i < len(s); i++ {
+		b := s[i]
+		if b < ' ' || b == 0x7f {
+			return true
+		}
+	}
+	return false
+}
diff --git a/src/net/url/url_test.go b/src/net/url/url_test.go
index 7c4ada2..c5fc90d 100644
--- a/src/net/url/url_test.go
+++ b/src/net/url/url_test.go
@@ -1738,12 +1738,33 @@
 }
 
 func TestInvalidUserPassword(t *testing.T) {
-	_, err := Parse("http://us\ner:pass\nword@foo.com/")
+	_, err := Parse("http://user^:passwo^rd@foo.com/")
 	if got, wantsub := fmt.Sprint(err), "net/url: invalid userinfo"; !strings.Contains(got, wantsub) {
 		t.Errorf("error = %q; want substring %q", got, wantsub)
 	}
 }
 
+func TestRejectControlCharacters(t *testing.T) {
+	tests := []string{
+		"http://foo.com/?foo\nbar",
+		"http\r://foo.com/",
+		"http://foo\x7f.com/",
+	}
+	for _, s := range tests {
+		_, err := Parse(s)
+		const wantSub = "net/url: invalid control character in URL"
+		if got := fmt.Sprint(err); !strings.Contains(got, wantSub) {
+			t.Errorf("Parse(%q) error = %q; want substring %q", s, got, wantSub)
+		}
+	}
+
+	// But don't reject non-ASCII CTLs, at least for now:
+	if _, err := Parse("http://foo.com/ctl\x80"); err != nil {
+		t.Errorf("error parsing URL with non-ASCII control byte: %v", err)
+	}
+
+}
+
 var escapeBenchmarks = []struct {
 	unescaped string
 	query     string
diff --git a/src/os/export_unix_test.go b/src/os/export_unix_test.go
new file mode 100644
index 0000000..032b1a9
--- /dev/null
+++ b/src/os/export_unix_test.go
@@ -0,0 +1,9 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
+
+package os
+
+var SplitPath = splitPath
diff --git a/src/os/file_unix.go b/src/os/file_unix.go
index 9f6fb64..257cee9 100644
--- a/src/os/file_unix.go
+++ b/src/os/file_unix.go
@@ -186,6 +186,7 @@
 const DevNull = "/dev/null"
 
 // openFileNolog is the Unix implementation of OpenFile.
+// Changes here should be reflected in openFdAt, if relevant.
 func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
 	setSticky := false
 	if !supportsCreateWithStickyBit && flag&O_CREATE != 0 && perm&ModeSticky != 0 {
diff --git a/src/os/os_unix_test.go b/src/os/os_unix_test.go
index 2aa930e..c9e5541 100644
--- a/src/os/os_unix_test.go
+++ b/src/os/os_unix_test.go
@@ -281,3 +281,28 @@
 	t.Parallel()
 	newFileTest(t, false)
 }
+
+func TestSplitPath(t *testing.T) {
+	t.Parallel()
+	for _, tt := range []struct{ path, wantDir, wantBase string }{
+		{"a", ".", "a"},
+		{"a/", ".", "a"},
+		{"a//", ".", "a"},
+		{"a/b", "a", "b"},
+		{"a/b/", "a", "b"},
+		{"a/b/c", "a/b", "c"},
+		{"/a", "/", "a"},
+		{"/a/", "/", "a"},
+		{"/a/b", "/a", "b"},
+		{"/a/b/", "/a", "b"},
+		{"/a/b/c", "/a/b", "c"},
+		{"//a", "/", "a"},
+		{"//a/", "/", "a"},
+		{"///a", "/", "a"},
+		{"///a/", "/", "a"},
+	} {
+		if dir, base := SplitPath(tt.path); dir != tt.wantDir || base != tt.wantBase {
+			t.Errorf("splitPath(%q) = %q, %q, want %q, %q", tt.path, dir, base, tt.wantDir, tt.wantBase)
+		}
+	}
+}
diff --git a/src/os/path.go b/src/os/path.go
index 30cc6c8..ba43ea3 100644
--- a/src/os/path.go
+++ b/src/os/path.go
@@ -58,6 +58,15 @@
 	return nil
 }
 
+// RemoveAll removes path and any children it contains.
+// It removes everything it can but returns the first error
+// it encounters. If the path does not exist, RemoveAll
+// returns nil (no error).
+// If there is an error, it will be of type *PathError.
+func RemoveAll(path string) error {
+	return removeAll(path)
+}
+
 // endsWithDot reports whether the final component of path is ".".
 func endsWithDot(path string) bool {
 	if path == "." {
diff --git a/src/os/path_unix.go b/src/os/path_unix.go
index 71427c3..da990b8 100644
--- a/src/os/path_unix.go
+++ b/src/os/path_unix.go
@@ -38,20 +38,30 @@
 func splitPath(path string) (string, string) {
 	// if no better parent is found, the path is relative from "here"
 	dirname := "."
-	// if no slashes in path, base is path
-	basename := path
+
+	// Remove all but one leading slash.
+	for len(path) > 1 && path[0] == '/' && path[1] == '/' {
+		path = path[1:]
+	}
 
 	i := len(path) - 1
 
-	// Remove trailing slashes
+	// Remove trailing slashes.
 	for ; i > 0 && path[i] == '/'; i-- {
 		path = path[:i]
 	}
 
+	// if no slashes in path, base is path
+	basename := path
+
 	// Remove leading directory path
 	for i--; i >= 0; i-- {
 		if path[i] == '/' {
-			dirname = path[:i+1]
+			if i == 0 {
+				dirname = path[:1]
+			} else {
+				dirname = path[:i]
+			}
 			basename = path[i+1:]
 			break
 		}
diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go
index f0fed6d..330963b 100644
--- a/src/os/removeall_at.go
+++ b/src/os/removeall_at.go
@@ -9,10 +9,11 @@
 import (
 	"internal/syscall/unix"
 	"io"
+	"runtime"
 	"syscall"
 )
 
-func RemoveAll(path string) error {
+func removeAll(path string) error {
 	if path == "" {
 		// fail silently to retain compatibility with previous behavior
 		// of RemoveAll. See issue 28830.
@@ -45,60 +46,79 @@
 	}
 	defer parent.Close()
 
-	return removeAllFrom(parent, base)
+	if err := removeAllFrom(parent, base); err != nil {
+		if pathErr, ok := err.(*PathError); ok {
+			pathErr.Path = parentDir + string(PathSeparator) + pathErr.Path
+			err = pathErr
+		}
+		return err
+	}
+	return nil
 }
 
-func removeAllFrom(parent *File, path string) error {
+func removeAllFrom(parent *File, base string) error {
 	parentFd := int(parent.Fd())
 	// Simple case: if Unlink (aka remove) works, we're done.
-	err := unix.Unlinkat(parentFd, path, 0)
+	err := unix.Unlinkat(parentFd, base, 0)
 	if err == nil || IsNotExist(err) {
 		return nil
 	}
 
-	// If not a "is directory" error, we have a problem
-	if err != syscall.EISDIR && err != syscall.EPERM {
-		return err
+	// EISDIR means that we have a directory, and we need to
+	// remove its contents.
+	// EPERM or EACCES means that we don't have write permission on
+	// the parent directory, but this entry might still be a directory
+	// whose contents need to be removed.
+	// Otherwise just return the error.
+	if err != syscall.EISDIR && err != syscall.EPERM && err != syscall.EACCES {
+		return &PathError{"unlinkat", base, err}
 	}
 
 	// Is this a directory we need to recurse into?
 	var statInfo syscall.Stat_t
-	statErr := unix.Fstatat(parentFd, path, &statInfo, unix.AT_SYMLINK_NOFOLLOW)
+	statErr := unix.Fstatat(parentFd, base, &statInfo, unix.AT_SYMLINK_NOFOLLOW)
 	if statErr != nil {
-		return statErr
+		if IsNotExist(statErr) {
+			return nil
+		}
+		return &PathError{"fstatat", base, statErr}
 	}
 	if statInfo.Mode&syscall.S_IFMT != syscall.S_IFDIR {
-		// Not a directory; return the error from the Remove
-		return err
+		// Not a directory; return the error from the unix.Unlinkat.
+		return &PathError{"unlinkat", base, err}
 	}
 
-	// Remove the directory's entries
+	// Remove the directory's entries.
 	var recurseErr error
 	for {
 		const request = 1024
 
 		// Open the directory to recurse into
-		file, err := openFdAt(parentFd, path)
+		file, err := openFdAt(parentFd, base)
 		if err != nil {
 			if IsNotExist(err) {
 				return nil
 			}
-			return err
+			recurseErr = &PathError{"openfdat", base, err}
+			break
 		}
 
 		names, readErr := file.Readdirnames(request)
-		// Errors other than EOF should stop us from continuing
+		// Errors other than EOF should stop us from continuing.
 		if readErr != nil && readErr != io.EOF {
 			file.Close()
 			if IsNotExist(readErr) {
 				return nil
 			}
-			return readErr
+			return &PathError{"readdirnames", base, readErr}
 		}
 
 		for _, name := range names {
 			err := removeAllFrom(file, name)
 			if err != nil {
+				if pathErr, ok := err.(*PathError); ok {
+					pathErr.Path = base + string(PathSeparator) + pathErr.Path
+				}
 				recurseErr = err
 			}
 		}
@@ -116,8 +136,8 @@
 		}
 	}
 
-	// Remove the directory itself
-	unlinkError := unix.Unlinkat(parentFd, path, unix.AT_REMOVEDIR)
+	// Remove the directory itself.
+	unlinkError := unix.Unlinkat(parentFd, base, unix.AT_REMOVEDIR)
 	if unlinkError == nil || IsNotExist(unlinkError) {
 		return nil
 	}
@@ -125,14 +145,34 @@
 	if recurseErr != nil {
 		return recurseErr
 	}
-	return unlinkError
+	return &PathError{"unlinkat", base, unlinkError}
 }
 
-func openFdAt(fd int, path string) (*File, error) {
-	fd, err := unix.Openat(fd, path, O_RDONLY, 0)
-	if err != nil {
-		return nil, err
+// openFdAt opens path relative to the directory in fd.
+// Other than that this should act like openFileNolog.
+// This acts like openFileNolog rather than OpenFile because
+// we are going to (try to) remove the file.
+// The contents of this file are not relevant for test caching.
+func openFdAt(dirfd int, name string) (*File, error) {
+	var r int
+	for {
+		var e error
+		r, e = unix.Openat(dirfd, name, O_RDONLY, 0)
+		if e == nil {
+			break
+		}
+
+		// See comment in openFileNolog.
+		if runtime.GOOS == "darwin" && e == syscall.EINTR {
+			continue
+		}
+
+		return nil, e
 	}
 
-	return NewFile(uintptr(fd), path), nil
+	if !supportsCloseOnExec {
+		syscall.CloseOnExec(r)
+	}
+
+	return newFile(uintptr(r), name, kindOpenFile), nil
 }
diff --git a/src/os/removeall_noat.go b/src/os/removeall_noat.go
index 80527e2..5a7dc26 100644
--- a/src/os/removeall_noat.go
+++ b/src/os/removeall_noat.go
@@ -11,11 +11,7 @@
 	"syscall"
 )
 
-// RemoveAll removes path and any children it contains.
-// It removes everything it can but returns the first error
-// it encounters. If the path does not exist, RemoveAll
-// returns nil (no error).
-func RemoveAll(path string) error {
+func removeAll(path string) error {
 	if path == "" {
 		// fail silently to retain compatibility with previous behavior
 		// of RemoveAll. See issue 28830.
diff --git a/src/os/removeall_test.go b/src/os/removeall_test.go
index 0f7dce0..945a38e 100644
--- a/src/os/removeall_test.go
+++ b/src/os/removeall_test.go
@@ -292,3 +292,124 @@
 		t.Error("subdirectory was not removed")
 	}
 }
+
+// Issue #29983.
+func TestRemoveAllButReadOnlyAndPathError(t *testing.T) {
+	switch runtime.GOOS {
+	case "nacl", "js", "windows":
+		t.Skipf("skipping test on %s", runtime.GOOS)
+	}
+
+	if Getuid() == 0 {
+		t.Skip("skipping test when running as root")
+	}
+
+	t.Parallel()
+
+	tempDir, err := ioutil.TempDir("", "TestRemoveAllButReadOnly-")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer RemoveAll(tempDir)
+
+	dirs := []string{
+		"a",
+		"a/x",
+		"a/x/1",
+		"b",
+		"b/y",
+		"b/y/2",
+		"c",
+		"c/z",
+		"c/z/3",
+	}
+	readonly := []string{
+		"b",
+	}
+	inReadonly := func(d string) bool {
+		for _, ro := range readonly {
+			if d == ro {
+				return true
+			}
+			dd, _ := filepath.Split(d)
+			if filepath.Clean(dd) == ro {
+				return true
+			}
+		}
+		return false
+	}
+
+	for _, dir := range dirs {
+		if err := Mkdir(filepath.Join(tempDir, dir), 0777); err != nil {
+			t.Fatal(err)
+		}
+	}
+	for _, dir := range readonly {
+		d := filepath.Join(tempDir, dir)
+		if err := Chmod(d, 0555); err != nil {
+			t.Fatal(err)
+		}
+
+		// Defer changing the mode back so that the deferred
+		// RemoveAll(tempDir) can succeed.
+		defer Chmod(d, 0777)
+	}
+
+	err = RemoveAll(tempDir)
+	if err == nil {
+		t.Fatal("RemoveAll succeeded unexpectedly")
+	}
+
+	// The error should be of type *PathError.
+	// see issue 30491 for details.
+	if pathErr, ok := err.(*PathError); ok {
+		if g, w := pathErr.Path, filepath.Join(tempDir, "b", "y"); g != w {
+			t.Errorf("got %q, expected pathErr.path %q", g, w)
+		}
+	} else {
+		t.Errorf("got %T, expected *os.PathError", err)
+	}
+
+	for _, dir := range dirs {
+		_, err := Stat(filepath.Join(tempDir, dir))
+		if inReadonly(dir) {
+			if err != nil {
+				t.Errorf("file %q was deleted but should still exist", dir)
+			}
+		} else {
+			if err == nil {
+				t.Errorf("file %q still exists but should have been deleted", dir)
+			}
+		}
+	}
+}
+
+func TestRemoveUnreadableDir(t *testing.T) {
+	switch runtime.GOOS {
+	case "nacl", "js", "windows":
+		t.Skipf("skipping test on %s", runtime.GOOS)
+	}
+
+	if Getuid() == 0 {
+		t.Skip("skipping test when running as root")
+	}
+
+	t.Parallel()
+
+	tempDir, err := ioutil.TempDir("", "TestRemoveAllButReadOnly-")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer RemoveAll(tempDir)
+
+	target := filepath.Join(tempDir, "d0", "d1", "d2")
+	if err := MkdirAll(target, 0755); err != nil {
+		t.Fatal(err)
+	}
+	if err := Chmod(target, 0300); err != nil {
+		t.Fatal(err)
+	}
+	if err := RemoveAll(filepath.Join(tempDir, "d0")); err != nil {
+		t.Fatal(err)
+	}
+}
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go
index bbb9030..aba1717 100644
--- a/src/path/filepath/path.go
+++ b/src/path/filepath/path.go
@@ -96,19 +96,14 @@
 		}
 		return originalPath + "."
 	}
-
-	n := len(path)
-	if volLen > 2 && n == 1 && os.IsPathSeparator(path[0]) {
-		// UNC volume name with trailing slash.
-		return FromSlash(originalPath[:volLen])
-	}
 	rooted := os.IsPathSeparator(path[0])
 
 	// Invariants:
 	//	reading from path; r is index of next byte to process.
-	//	writing to out; w is index of next byte to write.
-	//	dotdot is index in out where .. must stop, either because
+	//	writing to buf; w is index of next byte to write.
+	//	dotdot is index in buf where .. must stop, either because
 	//		it is the leading slash or it is a leading ../../.. prefix.
+	n := len(path)
 	out := lazybuf{path: path, volAndPath: originalPath, volLen: volLen}
 	r, dotdot := 0, 0
 	if rooted {
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go
index cbddda8..adda8c5 100644
--- a/src/path/filepath/path_test.go
+++ b/src/path/filepath/path_test.go
@@ -93,9 +93,6 @@
 	{`//host/share/foo/../baz`, `\\host\share\baz`},
 	{`\\a\b\..\c`, `\\a\b\c`},
 	{`\\a\b`, `\\a\b`},
-	{`\\a\b\`, `\\a\b`},
-	{`\\folder\share\foo`, `\\folder\share\foo`},
-	{`\\folder\share\foo\`, `\\folder\share\foo`},
 }
 
 func TestClean(t *testing.T) {
@@ -1374,13 +1371,27 @@
 }
 
 func TestIssue29372(t *testing.T) {
-	f, err := ioutil.TempFile("", "issue29372")
+	tmpDir, err := ioutil.TempDir("", "TestIssue29372")
 	if err != nil {
 		t.Fatal(err)
 	}
-	f.Close()
-	path := f.Name()
-	defer os.Remove(path)
+	defer os.RemoveAll(tmpDir)
+
+	if runtime.GOOS == "windows" {
+		// This test is broken on windows, if temporary directory
+		// is a symlink. See issue 29746.
+		// TODO(brainman): Remove this hack once issue #29746 is fixed.
+		tmpDir, err = filepath.EvalSymlinks(tmpDir)
+		if err != nil {
+			t.Fatal(err)
+		}
+	}
+
+	path := filepath.Join(tmpDir, "file.txt")
+	err = ioutil.WriteFile(path, nil, 0644)
+	if err != nil {
+		t.Fatal(err)
+	}
 
 	pathSeparator := string(filepath.Separator)
 	tests := []string{
@@ -1399,3 +1410,103 @@
 		}
 	}
 }
+
+// Issue 30520 part 1.
+func TestEvalSymlinksAboveRoot(t *testing.T) {
+	testenv.MustHaveSymlink(t)
+
+	t.Parallel()
+
+	tmpDir, err := ioutil.TempDir("", "TestEvalSymlinksAboveRoot")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer os.RemoveAll(tmpDir)
+
+	evalTmpDir, err := filepath.EvalSymlinks(tmpDir)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	if err := os.Mkdir(filepath.Join(evalTmpDir, "a"), 0777); err != nil {
+		t.Fatal(err)
+	}
+	if err := os.Symlink(filepath.Join(evalTmpDir, "a"), filepath.Join(evalTmpDir, "b")); err != nil {
+		t.Fatal(err)
+	}
+	if err := ioutil.WriteFile(filepath.Join(evalTmpDir, "a", "file"), nil, 0666); err != nil {
+		t.Fatal(err)
+	}
+
+	// Count the number of ".." elements to get to the root directory.
+	vol := filepath.VolumeName(evalTmpDir)
+	c := strings.Count(evalTmpDir[len(vol):], string(os.PathSeparator))
+	var dd []string
+	for i := 0; i < c+2; i++ {
+		dd = append(dd, "..")
+	}
+
+	wantSuffix := strings.Join([]string{"a", "file"}, string(os.PathSeparator))
+
+	// Try different numbers of "..".
+	for _, i := range []int{c, c + 1, c + 2} {
+		check := strings.Join([]string{evalTmpDir, strings.Join(dd[:i], string(os.PathSeparator)), evalTmpDir[len(vol)+1:], "b", "file"}, string(os.PathSeparator))
+		if resolved, err := filepath.EvalSymlinks(check); err != nil {
+			t.Errorf("EvalSymlinks(%q) failed: %v", check, err)
+		} else if !strings.HasSuffix(resolved, wantSuffix) {
+			t.Errorf("EvalSymlinks(%q) = %q does not end with %q", check, resolved, wantSuffix)
+		} else {
+			t.Logf("EvalSymlinks(%q) = %q", check, resolved)
+		}
+	}
+}
+
+// Issue 30520 part 2.
+func TestEvalSymlinksAboveRootChdir(t *testing.T) {
+	testenv.MustHaveSymlink(t)
+
+	tmpDir, err := ioutil.TempDir("", "TestEvalSymlinksAboveRootChdir")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer os.RemoveAll(tmpDir)
+
+	wd, err := os.Getwd()
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer os.Chdir(wd)
+
+	if err := os.Chdir(tmpDir); err != nil {
+		t.Fatal(err)
+	}
+
+	subdir := filepath.Join("a", "b")
+	if err := os.MkdirAll(subdir, 0777); err != nil {
+		t.Fatal(err)
+	}
+	if err := os.Symlink(subdir, "c"); err != nil {
+		t.Fatal(err)
+	}
+	if err := ioutil.WriteFile(filepath.Join(subdir, "file"), nil, 0666); err != nil {
+		t.Fatal(err)
+	}
+
+	subdir = filepath.Join("d", "e", "f")
+	if err := os.MkdirAll(subdir, 0777); err != nil {
+		t.Fatal(err)
+	}
+	if err := os.Chdir(subdir); err != nil {
+		t.Fatal(err)
+	}
+
+	check := filepath.Join("..", "..", "..", "c", "file")
+	wantSuffix := filepath.Join("a", "b", "file")
+	if resolved, err := filepath.EvalSymlinks(check); err != nil {
+		t.Errorf("EvalSymlinks(%q) failed: %v", check, err)
+	} else if !strings.HasSuffix(resolved, wantSuffix) {
+		t.Errorf("EvalSymlinks(%q) = %q does not end with %q", check, resolved, wantSuffix)
+	} else {
+		t.Logf("EvalSymlinks(%q) = %q", check, resolved)
+	}
+}
diff --git a/src/path/filepath/path_windows_test.go b/src/path/filepath/path_windows_test.go
index 3fcccfa..d1735d3 100644
--- a/src/path/filepath/path_windows_test.go
+++ b/src/path/filepath/path_windows_test.go
@@ -550,6 +550,9 @@
 		t.Errorf(`EvalSymlinks(%q): got %q, want %q`, dirlink, got, want)
 	}
 
+	// Make sure we have sufficient privilege to run mklink command.
+	testenv.MustHaveSymlink(t)
+
 	file := filepath.Join(tmpdir, "file")
 	err = ioutil.WriteFile(file, []byte(""), 0666)
 	if err != nil {
diff --git a/src/path/filepath/symlink.go b/src/path/filepath/symlink.go
index 4b41039..de043c1 100644
--- a/src/path/filepath/symlink.go
+++ b/src/path/filepath/symlink.go
@@ -44,18 +44,26 @@
 		} else if path[start:end] == ".." {
 			// Back up to previous component if possible.
 			// Note that volLen includes any leading slash.
+
+			// Set r to the index of the last slash in dest,
+			// after the volume.
 			var r int
 			for r = len(dest) - 1; r >= volLen; r-- {
 				if os.IsPathSeparator(dest[r]) {
 					break
 				}
 			}
-			if r < volLen {
+			if r < volLen || dest[r+1:] == ".." {
+				// Either path has no slashes
+				// (it's empty or just "C:")
+				// or it ends in a ".." we had to keep.
+				// Either way, keep this "..".
 				if len(dest) > volLen {
 					dest += pathSeparator
 				}
 				dest += ".."
 			} else {
+				// Discard everything since the last slash.
 				dest = dest[:r]
 			}
 			continue
diff --git a/src/reflect/value.go b/src/reflect/value.go
index 7ae2dd8..372b7a6 100644
--- a/src/reflect/value.go
+++ b/src/reflect/value.go
@@ -561,10 +561,11 @@
 				continue
 			}
 			addr := add(ptr, off, "typ.size > 0")
+			// We are writing to stack. No write barrier.
 			if v.flag&flagIndir != 0 {
-				typedmemmove(typ, addr, v.ptr)
+				memmove(addr, v.ptr, typ.size)
 			} else {
-				*(*unsafe.Pointer)(addr) = v.ptr
+				*(*uintptr)(addr) = uintptr(v.ptr)
 			}
 			off += typ.size
 		}
diff --git a/src/runtime/asm_wasm.s b/src/runtime/asm_wasm.s
index 374b9f7..6ce1c70 100644
--- a/src/runtime/asm_wasm.s
+++ b/src/runtime/asm_wasm.s
@@ -443,7 +443,7 @@
 	// Record value
 	MOVD R1, 0(R5)
 	// Record *slot
-	MOVD R0, 8(R5)
+	MOVD (R0), 8(R5)
 
 	// Increment wbBuf.next
 	Get R5
diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go
index 6fba4dd..03ebf02 100644
--- a/src/runtime/crash_test.go
+++ b/src/runtime/crash_test.go
@@ -728,3 +728,15 @@
 
 	runtime.G0StackOverflow()
 }
+
+// Test that panic message is not clobbered.
+// See issue 30150.
+func TestDoublePanic(t *testing.T) {
+	output := runTestProg(t, "testprog", "DoublePanic", "GODEBUG=clobberfree=1")
+	wants := []string{"panic: XXX", "panic: YYY"}
+	for _, want := range wants {
+		if !strings.Contains(output, want) {
+			t.Errorf("output:\n%s\n\nwant output containing: %s", output, want)
+		}
+	}
+}
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index 9eaf92d..9be501d 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -513,3 +513,116 @@
 		}
 	}
 }
+
+// Span is a safe wrapper around an mspan, whose memory
+// is managed manually.
+type Span struct {
+	*mspan
+}
+
+func AllocSpan(base, npages uintptr) Span {
+	lock(&mheap_.lock)
+	s := (*mspan)(mheap_.spanalloc.alloc())
+	unlock(&mheap_.lock)
+	s.init(base, npages)
+	return Span{s}
+}
+
+func (s *Span) Free() {
+	lock(&mheap_.lock)
+	mheap_.spanalloc.free(unsafe.Pointer(s.mspan))
+	unlock(&mheap_.lock)
+	s.mspan = nil
+}
+
+func (s Span) Base() uintptr {
+	return s.mspan.base()
+}
+
+func (s Span) Pages() uintptr {
+	return s.mspan.npages
+}
+
+type TreapIter struct {
+	treapIter
+}
+
+func (t TreapIter) Span() Span {
+	return Span{t.span()}
+}
+
+func (t TreapIter) Valid() bool {
+	return t.valid()
+}
+
+func (t TreapIter) Next() TreapIter {
+	return TreapIter{t.next()}
+}
+
+func (t TreapIter) Prev() TreapIter {
+	return TreapIter{t.prev()}
+}
+
+// Treap is a safe wrapper around mTreap for testing.
+//
+// It must never be heap-allocated because mTreap is
+// notinheap.
+//
+//go:notinheap
+type Treap struct {
+	mTreap
+}
+
+func (t *Treap) Start() TreapIter {
+	return TreapIter{t.start()}
+}
+
+func (t *Treap) End() TreapIter {
+	return TreapIter{t.end()}
+}
+
+func (t *Treap) Insert(s Span) {
+	// mTreap uses a fixalloc in mheap_ for treapNode
+	// allocation which requires the mheap_ lock to manipulate.
+	// Locking here is safe because the treap itself never allocs
+	// or otherwise ends up grabbing this lock.
+	lock(&mheap_.lock)
+	t.insert(s.mspan)
+	unlock(&mheap_.lock)
+	t.CheckInvariants()
+}
+
+func (t *Treap) Find(npages uintptr) TreapIter {
+	return TreapIter{treapIter{t.find(npages)}}
+}
+
+func (t *Treap) Erase(i TreapIter) {
+	// mTreap uses a fixalloc in mheap_ for treapNode
+	// freeing which requires the mheap_ lock to manipulate.
+	// Locking here is safe because the treap itself never allocs
+	// or otherwise ends up grabbing this lock.
+	lock(&mheap_.lock)
+	t.erase(i.treapIter)
+	unlock(&mheap_.lock)
+	t.CheckInvariants()
+}
+
+func (t *Treap) RemoveSpan(s Span) {
+	// See Erase about locking.
+	lock(&mheap_.lock)
+	t.removeSpan(s.mspan)
+	unlock(&mheap_.lock)
+	t.CheckInvariants()
+}
+
+func (t *Treap) Size() int {
+	i := 0
+	t.mTreap.treap.walkTreap(func(t *treapNode) {
+		i++
+	})
+	return i
+}
+
+func (t *Treap) CheckInvariants() {
+	t.mTreap.treap.walkTreap(checkTreapNode)
+}
diff --git a/src/runtime/extern.go b/src/runtime/extern.go
index af858a3..e308dd3 100644
--- a/src/runtime/extern.go
+++ b/src/runtime/extern.go
@@ -27,6 +27,10 @@
 	allocfreetrace: setting allocfreetrace=1 causes every allocation to be
 	profiled and a stack trace printed on each object's allocation and free.
 
+	clobberfree: setting clobberfree=1 causes the garbage collector to
+	clobber the memory content of an object with bad content when it frees
+	the object.
+
 	cgocheck: setting cgocheck=0 disables all checks for packages
 	using cgo to incorrectly pass Go pointers to non-Go code.
 	Setting cgocheck=1 (the default) enables relatively cheap
@@ -123,7 +127,7 @@
 	IDs will refer to the ID of the goroutine at the time of creation; it's possible for this
 	ID to be reused for another goroutine. Setting N to 0 will report no ancestry information.
 
-The net and net/http packages also refer to debugging variables in GODEBUG.
+The net, net/http, and crypto/tls packages also refer to debugging variables in GODEBUG.
 See the documentation for those packages for details.
 
 The GOMAXPROCS variable limits the number of operating system threads that
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index c1a89dc..8c617bb 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -1012,7 +1012,7 @@
 	}
 
 	if rate := MemProfileRate; rate > 0 {
-		if size < uintptr(rate) && int32(size) < c.next_sample {
+		if rate != 1 && int32(size) < c.next_sample {
 			c.next_sample -= int32(size)
 		} else {
 			mp := acquirem()
diff --git a/src/runtime/mgclarge.go b/src/runtime/mgclarge.go
index 7b01a11..0e39c66 100644
--- a/src/runtime/mgclarge.go
+++ b/src/runtime/mgclarge.go
@@ -134,16 +134,19 @@
 			return t.npagesKey < npages
 		}
 		// t.npagesKey == npages
-		return uintptr(unsafe.Pointer(t.spanKey)) < uintptr(unsafe.Pointer(s))
+		return t.spanKey.base() < s.base()
 	}
 
 	if t == nil {
 		return
 	}
-	if t.spanKey.npages != t.npagesKey || t.spanKey.next != nil {
+	if t.spanKey.next != nil || t.spanKey.prev != nil || t.spanKey.list != nil {
+		throw("span may be on an mSpanList while simultaneously in the treap")
+	}
+	if t.spanKey.npages != t.npagesKey {
 		println("runtime: checkTreapNode treapNode t=", t, "     t.npagesKey=", t.npagesKey,
 			"t.spanKey.npages=", t.spanKey.npages)
-		throw("why does span.npages and treap.ngagesKey do not match?")
+		throw("span.npages and treap.npagesKey do not match")
 	}
 	if t.left != nil && lessThan(t.left.npagesKey, t.left.spanKey) {
 		throw("t.lessThan(t.left.npagesKey, t.left.spanKey) is not false")
@@ -298,24 +301,30 @@
 // find searches for, finds, and returns the treap node containing the
 // smallest span that can hold npages. If no span has at least npages
 // it returns nil.
-// This is slightly more complicated than a simple binary tree search
-// since if an exact match is not found the next larger node is
-// returned.
+// This is a simple binary tree search that tracks the best-fit node found
+// so far. The best-fit node is guaranteed to be on the path to a
+// (maybe non-existent) lowest-base exact match.
 func (root *mTreap) find(npages uintptr) *treapNode {
+	var best *treapNode
 	t := root.treap
 	for t != nil {
 		if t.spanKey == nil {
 			throw("treap node with nil spanKey found")
 		}
-		if t.npagesKey < npages {
-			t = t.right
-		} else if t.left != nil && t.left.npagesKey >= npages {
+		// If we found an exact match, try to go left anyway. There could be
+		// a span there with a lower base address.
+		//
+		// Don't bother checking nil-ness of left and right here; even if t
+		// becomes nil, we already know the other path had nothing better for
+		// us anyway.
+		if t.npagesKey >= npages {
+			best = t
 			t = t.left
 		} else {
-			return t
+			t = t.right
 		}
 	}
-	return nil
+	return best
 }
 
 // removeSpan searches for, finds, deletes span along with
diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go
index 86416ca..cc4e7d0 100644
--- a/src/runtime/mgcmark.go
+++ b/src/runtime/mgcmark.go
@@ -709,7 +709,20 @@
 		return true
 	}
 	gentraceback(^uintptr(0), ^uintptr(0), 0, gp, 0, nil, 0x7fffffff, scanframe, nil, 0)
+
+	// Find additional pointers that point into the stack from the heap.
+	// Currently this includes defers and panics. See also function copystack.
 	tracebackdefers(gp, scanframe, nil)
+	for d := gp._defer; d != nil; d = d.link {
+		// tracebackdefers above does not scan the func value, which could
+		// be a stack allocated closure. See issue 30453.
+		if d.fn != nil {
+			scanblock(uintptr(unsafe.Pointer(&d.fn)), sys.PtrSize, &oneptrmask[0], gcw, &state)
+		}
+	}
+	if gp._panic != nil {
+		state.putPtr(uintptr(unsafe.Pointer(gp._panic)))
+	}
 
 	// Find and scan all reachable stack objects.
 	state.buildIndex()
diff --git a/src/runtime/mgcsweep.go b/src/runtime/mgcsweep.go
index edb9fca..6ac3b03 100644
--- a/src/runtime/mgcsweep.go
+++ b/src/runtime/mgcsweep.go
@@ -291,7 +291,7 @@
 		}
 	}
 
-	if debug.allocfreetrace != 0 || raceenabled || msanenabled {
+	if debug.allocfreetrace != 0 || debug.clobberfree != 0 || raceenabled || msanenabled {
 		// Find all newly freed objects. This doesn't have to
 		// efficient; allocfreetrace has massive overhead.
 		mbits := s.markBitsForBase()
@@ -302,6 +302,9 @@
 				if debug.allocfreetrace != 0 {
 					tracefree(unsafe.Pointer(x), size)
 				}
+				if debug.clobberfree != 0 {
+					clobberfree(unsafe.Pointer(x), size)
+				}
 				if raceenabled {
 					racefree(unsafe.Pointer(x), size)
 				}
@@ -446,3 +449,12 @@
 		traceGCSweepDone()
 	}
 }
+
+// clobberfree sets the memory content at x to bad content, for debugging
+// purposes.
+func clobberfree(x unsafe.Pointer, size uintptr) {
+	// size (span.elemsize) is always a multiple of 4.
+	for i := uintptr(0); i < size; i += 4 {
+		*(*uint32)(add(x, i)) = 0xdeadbeef
+	}
+}
diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go
index f5b5ba9..6c0ea1b 100644
--- a/src/runtime/mheap.go
+++ b/src/runtime/mheap.go
@@ -107,6 +107,14 @@
 	// This is accessed atomically.
 	reclaimCredit uintptr
 
+	// scavengeCredit is spare credit for extra bytes scavenged.
+	// Since the scavenging mechanisms operate on spans, it may
+	// scavenge more than requested. Any spare pages released
+	// go to this credit pool.
+	//
+	// This is protected by the mheap lock.
+	scavengeCredit uintptr
+
 	// Malloc stats.
 	largealloc  uint64                  // bytes allocated for large objects
 	nlargealloc uint64                  // number of large object allocations
@@ -165,7 +173,7 @@
 	// simply blocking GC (by disabling preemption).
 	sweepArenas []arenaIdx
 
-	_ uint32 // ensure 64-bit alignment of central
+	// _ uint32 // ensure 64-bit alignment of central
 
 	// central free lists for small size classes.
 	// the padding makes sure that the mcentrals are
@@ -419,6 +427,115 @@
 	return start, end
 }
 
+func (h *mheap) coalesce(s *mspan) {
+	// We scavenge s at the end after coalescing if s or anything
+	// it merged with is marked scavenged.
+	needsScavenge := false
+	prescavenged := s.released() // number of bytes already scavenged.
+
+	// merge is a helper which merges other into s, deletes references to other
+	// in heap metadata, and then discards it. other must be adjacent to s.
+	merge := func(other *mspan) {
+		// Adjust s via base and npages and also in heap metadata.
+		s.npages += other.npages
+		s.needzero |= other.needzero
+		if other.startAddr < s.startAddr {
+			s.startAddr = other.startAddr
+			h.setSpan(s.base(), s)
+		} else {
+			h.setSpan(s.base()+s.npages*pageSize-1, s)
+		}
+
+		// If before or s are scavenged, then we need to scavenge the final coalesced span.
+		needsScavenge = needsScavenge || other.scavenged || s.scavenged
+		prescavenged += other.released()
+
+		// The size is potentially changing so the treap needs to delete adjacent nodes and
+		// insert back as a combined node.
+		if other.scavenged {
+			h.scav.removeSpan(other)
+		} else {
+			h.free.removeSpan(other)
+		}
+		other.state = mSpanDead
+		h.spanalloc.free(unsafe.Pointer(other))
+	}
+
+	// realign is a helper which shrinks other and grows s such that their
+	// boundary is on a physical page boundary.
+	realign := func(a, b, other *mspan) {
+		// Caller must ensure a.startAddr < b.startAddr and that either a or
+		// b is s. a and b must be adjacent. other is whichever of the two is
+		// not s.
+
+		// If pageSize <= physPageSize then spans are always aligned
+		// to physical page boundaries, so just exit.
+		if pageSize <= physPageSize {
+			return
+		}
+		// Since we're resizing other, we must remove it from the treap.
+		if other.scavenged {
+			h.scav.removeSpan(other)
+		} else {
+			h.free.removeSpan(other)
+		}
+		// Round boundary to the nearest physical page size, toward the
+		// scavenged span.
+		boundary := b.startAddr
+		if a.scavenged {
+			boundary &^= (physPageSize - 1)
+		} else {
+			boundary = (boundary + physPageSize - 1) &^ (physPageSize - 1)
+		}
+		a.npages = (boundary - a.startAddr) / pageSize
+		b.npages = (b.startAddr + b.npages*pageSize - boundary) / pageSize
+		b.startAddr = boundary
+
+		h.setSpan(boundary-1, a)
+		h.setSpan(boundary, b)
+
+		// Re-insert other now that it has a new size.
+		if other.scavenged {
+			h.scav.insert(other)
+		} else {
+			h.free.insert(other)
+		}
+	}
+
+	// Coalesce with earlier, later spans.
+	if before := spanOf(s.base() - 1); before != nil && before.state == mSpanFree {
+		if s.scavenged == before.scavenged {
+			merge(before)
+		} else {
+			realign(before, s, before)
+		}
+	}
+
+	// Now check to see if next (greater addresses) span is free and can be coalesced.
+	if after := spanOf(s.base() + s.npages*pageSize); after != nil && after.state == mSpanFree {
+		if s.scavenged == after.scavenged {
+			merge(after)
+		} else {
+			realign(s, after, after)
+		}
+	}
+
+	if needsScavenge {
+		// When coalescing spans, some physical pages which
+		// were not returned to the OS previously because
+		// they were only partially covered by the span suddenly
+		// become available for scavenging. We want to make sure
+		// those holes are filled in, and the span is properly
+		// scavenged. Rather than trying to detect those holes
+		// directly, we collect how many bytes were already
+		// scavenged above and subtract that from heap_released
+		// before re-scavenging the entire newly-coalesced span,
+		// which will implicitly bump up heap_released.
+		memstats.heap_released -= uint64(prescavenged)
+		s.scavenge()
+	}
+}
+
 func (s *mspan) scavenge() uintptr {
 	// start and end must be rounded in, otherwise madvise
 	// will round them *out* and release more memory
@@ -1215,62 +1332,8 @@
 		s.unusedsince = nanotime()
 	}
 
-	// We scavenge s at the end after coalescing if s or anything
-	// it merged with is marked scavenged.
-	needsScavenge := false
-	prescavenged := s.released() // number of bytes already scavenged.
-
-	// Coalesce with earlier, later spans.
-	if before := spanOf(s.base() - 1); before != nil && before.state == mSpanFree {
-		// Now adjust s.
-		s.startAddr = before.startAddr
-		s.npages += before.npages
-		s.needzero |= before.needzero
-		h.setSpan(before.base(), s)
-		// If before or s are scavenged, then we need to scavenge the final coalesced span.
-		needsScavenge = needsScavenge || before.scavenged || s.scavenged
-		prescavenged += before.released()
-		// The size is potentially changing so the treap needs to delete adjacent nodes and
-		// insert back as a combined node.
-		if before.scavenged {
-			h.scav.removeSpan(before)
-		} else {
-			h.free.removeSpan(before)
-		}
-		before.state = mSpanDead
-		h.spanalloc.free(unsafe.Pointer(before))
-	}
-
-	// Now check to see if next (greater addresses) span is free and can be coalesced.
-	if after := spanOf(s.base() + s.npages*pageSize); after != nil && after.state == mSpanFree {
-		s.npages += after.npages
-		s.needzero |= after.needzero
-		h.setSpan(s.base()+s.npages*pageSize-1, s)
-		needsScavenge = needsScavenge || after.scavenged || s.scavenged
-		prescavenged += after.released()
-		if after.scavenged {
-			h.scav.removeSpan(after)
-		} else {
-			h.free.removeSpan(after)
-		}
-		after.state = mSpanDead
-		h.spanalloc.free(unsafe.Pointer(after))
-	}
-
-	if needsScavenge {
-		// When coalescing spans, some physical pages which
-		// were not returned to the OS previously because
-		// they were only partially covered by the span suddenly
-		// become available for scavenging. We want to make sure
-		// those holes are filled in, and the span is properly
-		// scavenged. Rather than trying to detect those holes
-		// directly, we collect how many bytes were already
-		// scavenged above and subtract that from heap_released
-		// before re-scavenging the entire newly-coalesced span,
-		// which will implicitly bump up heap_released.
-		memstats.heap_released -= uint64(prescavenged)
-		s.scavenge()
-	}
+	// Coalesce span with neighbors.
+	h.coalesce(s)
 
 	// Insert s into the appropriate treap.
 	if s.scavenged {
@@ -1284,6 +1347,14 @@
 // starting from the largest span and working down. It then takes those spans
 // and places them in scav. h must be locked.
 func (h *mheap) scavengeLargest(nbytes uintptr) {
+	// Use up scavenge credit if there's any available.
+	if nbytes > h.scavengeCredit {
+		nbytes -= h.scavengeCredit
+		h.scavengeCredit = 0
+	} else {
+		h.scavengeCredit -= nbytes
+		return
+	}
 	// Iterate over the treap backwards (from largest to smallest) scavenging spans
 	// until we've reached our quota of nbytes.
 	released := uintptr(0)
@@ -1304,10 +1375,18 @@
 		}
 		n := t.prev()
 		h.free.erase(t)
+		// Now that s is scavenged, we must eagerly coalesce it
+		// with its neighbors to prevent having two spans with
+		// the same scavenged state adjacent to each other.
+		h.coalesce(s)
 		t = n
 		h.scav.insert(s)
 		released += r
 	}
+	// If we over-scavenged, turn that extra amount into credit.
+	if released > nbytes {
+		h.scavengeCredit += released - nbytes
+	}
 }
 
 // scavengeAll visits each node in the unscav treap and scavenges the
@@ -1323,6 +1402,10 @@
 			r := s.scavenge()
 			if r != 0 {
 				h.free.erase(t)
+				// Now that s is scavenged, we must eagerly coalesce it
+				// with its neighbors to prevent having two spans with
+				// the same scavenged state adjacent to each other.
+				h.coalesce(s)
 				h.scav.insert(s)
 				released += r
 			}
diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go
index 2e1ec58..d3e84fe 100644
--- a/src/runtime/os_windows.go
+++ b/src/runtime/os_windows.go
@@ -29,6 +29,7 @@
 //go:cgo_import_dynamic runtime._GetProcessAffinityMask GetProcessAffinityMask%3 "kernel32.dll"
 //go:cgo_import_dynamic runtime._GetQueuedCompletionStatus GetQueuedCompletionStatus%5 "kernel32.dll"
 //go:cgo_import_dynamic runtime._GetStdHandle GetStdHandle%1 "kernel32.dll"
+//go:cgo_import_dynamic runtime._GetSystemDirectoryA GetSystemDirectoryA%2 "kernel32.dll"
 //go:cgo_import_dynamic runtime._GetSystemInfo GetSystemInfo%1 "kernel32.dll"
 //go:cgo_import_dynamic runtime._GetThreadContext GetThreadContext%2 "kernel32.dll"
 //go:cgo_import_dynamic runtime._LoadLibraryW LoadLibraryW%1 "kernel32.dll"
@@ -47,12 +48,9 @@
 //go:cgo_import_dynamic runtime._VirtualAlloc VirtualAlloc%4 "kernel32.dll"
 //go:cgo_import_dynamic runtime._VirtualFree VirtualFree%3 "kernel32.dll"
 //go:cgo_import_dynamic runtime._VirtualQuery VirtualQuery%3 "kernel32.dll"
-//go:cgo_import_dynamic runtime._WSAGetOverlappedResult WSAGetOverlappedResult%5 "ws2_32.dll"
 //go:cgo_import_dynamic runtime._WaitForSingleObject WaitForSingleObject%2 "kernel32.dll"
 //go:cgo_import_dynamic runtime._WriteConsoleW WriteConsoleW%5 "kernel32.dll"
 //go:cgo_import_dynamic runtime._WriteFile WriteFile%5 "kernel32.dll"
-//go:cgo_import_dynamic runtime._timeBeginPeriod timeBeginPeriod%1 "winmm.dll"
-//go:cgo_import_dynamic runtime._timeEndPeriod timeEndPeriod%1 "winmm.dll"
 
 type stdFunction unsafe.Pointer
 
@@ -75,6 +73,7 @@
 	_GetProcessAffinityMask,
 	_GetQueuedCompletionStatus,
 	_GetStdHandle,
+	_GetSystemDirectoryA,
 	_GetSystemInfo,
 	_GetSystemTimeAsFileTime,
 	_GetThreadContext,
@@ -96,12 +95,9 @@
 	_VirtualAlloc,
 	_VirtualFree,
 	_VirtualQuery,
-	_WSAGetOverlappedResult,
 	_WaitForSingleObject,
 	_WriteConsoleW,
 	_WriteFile,
-	_timeBeginPeriod,
-	_timeEndPeriod,
 	_ stdFunction
 
 	// Following syscalls are only available on some Windows PCs.
@@ -109,6 +105,7 @@
 	_AddDllDirectory,
 	_AddVectoredContinueHandler,
 	_GetQueuedCompletionStatusEx,
+	_LoadLibraryExA,
 	_LoadLibraryExW,
 	_ stdFunction
 
@@ -126,6 +123,12 @@
 	// links wrong printf function to cgo executable (see issue
 	// 12030 for details).
 	_NtWaitForSingleObject stdFunction
+
+	// These are from non-kernel32.dll, so we prefer to LoadLibraryEx them.
+	_timeBeginPeriod,
+	_timeEndPeriod,
+	_WSAGetOverlappedResult,
+	_ stdFunction
 )
 
 // Function to be called by windows CreateThread
@@ -173,6 +176,26 @@
 	return stdFunction(unsafe.Pointer(f))
 }
 
+var sysDirectory [521]byte
+var sysDirectoryLen uintptr
+
+func windowsLoadSystemLib(name []byte) uintptr {
+	if useLoadLibraryEx {
+		return stdcall3(_LoadLibraryExA, uintptr(unsafe.Pointer(&name[0])), 0, _LOAD_LIBRARY_SEARCH_SYSTEM32)
+	} else {
+		if sysDirectoryLen == 0 {
+			l := stdcall2(_GetSystemDirectoryA, uintptr(unsafe.Pointer(&sysDirectory[0])), uintptr(len(sysDirectory)-1))
+			if l == 0 || l > uintptr(len(sysDirectory)-1) {
+				throw("Unable to determine system directory")
+			}
+			sysDirectory[l] = '\\'
+			sysDirectoryLen = l + 1
+		}
+		absName := append(sysDirectory[:sysDirectoryLen], name...)
+		return stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&absName[0])))
+	}
+}
+
 func loadOptionalSyscalls() {
 	var kernel32dll = []byte("kernel32.dll\000")
 	k32 := stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&kernel32dll[0])))
@@ -182,17 +205,19 @@
 	_AddDllDirectory = windowsFindfunc(k32, []byte("AddDllDirectory\000"))
 	_AddVectoredContinueHandler = windowsFindfunc(k32, []byte("AddVectoredContinueHandler\000"))
 	_GetQueuedCompletionStatusEx = windowsFindfunc(k32, []byte("GetQueuedCompletionStatusEx\000"))
+	_LoadLibraryExA = windowsFindfunc(k32, []byte("LoadLibraryExA\000"))
 	_LoadLibraryExW = windowsFindfunc(k32, []byte("LoadLibraryExW\000"))
+	useLoadLibraryEx = (_LoadLibraryExW != nil && _LoadLibraryExA != nil && _AddDllDirectory != nil)
 
 	var advapi32dll = []byte("advapi32.dll\000")
-	a32 := stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&advapi32dll[0])))
+	a32 := windowsLoadSystemLib(advapi32dll)
 	if a32 == 0 {
 		throw("advapi32.dll not found")
 	}
 	_RtlGenRandom = windowsFindfunc(a32, []byte("SystemFunction036\000"))
 
 	var ntdll = []byte("ntdll.dll\000")
-	n32 := stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&ntdll[0])))
+	n32 := windowsLoadSystemLib(ntdll)
 	if n32 == 0 {
 		throw("ntdll.dll not found")
 	}
@@ -205,6 +230,27 @@
 		}
 	}
 
+	var winmmdll = []byte("winmm.dll\000")
+	m32 := windowsLoadSystemLib(winmmdll)
+	if m32 == 0 {
+		throw("winmm.dll not found")
+	}
+	_timeBeginPeriod = windowsFindfunc(m32, []byte("timeBeginPeriod\000"))
+	_timeEndPeriod = windowsFindfunc(m32, []byte("timeEndPeriod\000"))
+	if _timeBeginPeriod == nil || _timeEndPeriod == nil {
+		throw("timeBegin/EndPeriod not found")
+	}
+
+	var ws232dll = []byte("ws2_32.dll\000")
+	ws232 := windowsLoadSystemLib(ws232dll)
+	if ws232 == 0 {
+		throw("ws2_32.dll not found")
+	}
+	_WSAGetOverlappedResult = windowsFindfunc(ws232, []byte("WSAGetOverlappedResult\000"))
+	if _WSAGetOverlappedResult == nil {
+		throw("WSAGetOverlappedResult not found")
+	}
+
 	if windowsFindfunc(n32, []byte("wine_get_version\000")) != nil {
 		// running on Wine
 		initWine(k32)
@@ -311,8 +357,6 @@
 
 	loadOptionalSyscalls()
 
-	useLoadLibraryEx = (_LoadLibraryExW != nil && _AddDllDirectory != nil)
-
 	disableWER()
 
 	initExceptionHandler()
diff --git a/src/runtime/runtime-lldb_test.go b/src/runtime/runtime-lldb_test.go
index fe3a0eb..08d6a34 100644
--- a/src/runtime/runtime-lldb_test.go
+++ b/src/runtime/runtime-lldb_test.go
@@ -139,6 +139,7 @@
 	if final := os.Getenv("GOROOT_FINAL"); final != "" && runtime.GOROOT() != final {
 		t.Skip("gdb test can fail with GOROOT_FINAL pending")
 	}
+	testenv.SkipFlaky(t, 31188)
 
 	checkLldbPython(t)
 
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index c5667e7..0c0a31e 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -301,6 +301,7 @@
 var debug struct {
 	allocfreetrace     int32
 	cgocheck           int32
+	clobberfree        int32
 	efence             int32
 	gccheckmark        int32
 	gcpacertrace       int32
@@ -318,6 +319,7 @@
 
 var dbgvars = []dbgVar{
 	{"allocfreetrace", &debug.allocfreetrace},
+	{"clobberfree", &debug.clobberfree},
 	{"cgocheck", &debug.cgocheck},
 	{"efence", &debug.efence},
 	{"gccheckmark", &debug.gccheckmark},
diff --git a/src/runtime/stack_test.go b/src/runtime/stack_test.go
index f523817..7bc6396 100644
--- a/src/runtime/stack_test.go
+++ b/src/runtime/stack_test.go
@@ -787,3 +787,11 @@
 		}
 	}
 }
+
+// Test that defer closure is correctly scanned when the stack is scanned.
+func TestDeferLiveness(t *testing.T) {
+	output := runTestProg(t, "testprog", "DeferLiveness", "GODEBUG=clobberfree=1")
+	if output != "" {
+		t.Errorf("output:\n%s\n\nwant no output", output)
+	}
+}
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index e7ce3de..17e342e 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -474,7 +474,11 @@
 		return nil
 	}
 	if inldata := funcdata(f, _FUNCDATA_InlTree); inldata != nil {
-		if ix := pcdatavalue(f, _PCDATA_InlTreeIndex, pc, nil); ix >= 0 {
+		// Note: strict=false so bad PCs (those between functions) don't crash the runtime.
+		// We just report the preceeding function in that situation. See issue 29735.
+		// TODO: Perhaps we should report no function at all in that case.
+		// The runtime currently doesn't have function end info, alas.
+		if ix := pcdatavalue1(f, _PCDATA_InlTreeIndex, pc, nil, false); ix >= 0 {
 			inltree := (*[1 << 20]inlinedCall)(inldata)
 			name := funcnameFromNameoff(f, inltree[ix].func_)
 			file, line := funcline(f, pc)
@@ -756,12 +760,22 @@
 	return x
 }
 
+func pcdatastart(f funcInfo, table int32) int32 {
+	return *(*int32)(add(unsafe.Pointer(&f.nfuncdata), unsafe.Sizeof(f.nfuncdata)+uintptr(table)*4))
+}
+
 func pcdatavalue(f funcInfo, table int32, targetpc uintptr, cache *pcvalueCache) int32 {
 	if table < 0 || table >= f.npcdata {
 		return -1
 	}
-	off := *(*int32)(add(unsafe.Pointer(&f.nfuncdata), unsafe.Sizeof(f.nfuncdata)+uintptr(table)*4))
-	return pcvalue(f, off, targetpc, cache, true)
+	return pcvalue(f, pcdatastart(f, table), targetpc, cache, true)
+}
+
+func pcdatavalue1(f funcInfo, table int32, targetpc uintptr, cache *pcvalueCache, strict bool) int32 {
+	if table < 0 || table >= f.npcdata {
+		return -1
+	}
+	return pcvalue(f, pcdatastart(f, table), targetpc, cache, strict)
 }
 
 func funcdata(f funcInfo, i uint8) unsafe.Pointer {
diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go
index 8cfc711..36ad751 100644
--- a/src/runtime/syscall_windows.go
+++ b/src/runtime/syscall_windows.go
@@ -104,9 +104,13 @@
 
 const _LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
 
+// When available, this function will use LoadLibraryEx with the filename
+// parameter and the important SEARCH_SYSTEM32 argument. But on systems that
+// do not have that option, absoluteFilepath should contain a fallback
+// to the full path inside of system32 for use with vanilla LoadLibrary.
 //go:linkname syscall_loadsystemlibrary syscall.loadsystemlibrary
 //go:nosplit
-func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) {
+func syscall_loadsystemlibrary(filename *uint16, absoluteFilepath *uint16) (handle, err uintptr) {
 	lockOSThread()
 	defer unlockOSThread()
 	c := &getg().m.syscall
@@ -121,15 +125,9 @@
 		}{filename, 0, _LOAD_LIBRARY_SEARCH_SYSTEM32}
 		c.args = uintptr(noescape(unsafe.Pointer(&args)))
 	} else {
-		// User doesn't have KB2533623 installed. The caller
-		// wanted to only load the filename DLL from the
-		// System32 directory but that facility doesn't exist,
-		// so just load it the normal way. This is a potential
-		// security risk, but so is not installing security
-		// updates.
 		c.fn = getLoadLibrary()
 		c.n = 1
-		c.args = uintptr(noescape(unsafe.Pointer(&filename)))
+		c.args = uintptr(noescape(unsafe.Pointer(&absoluteFilepath)))
 	}
 
 	cgocall(asmstdcallAddr, unsafe.Pointer(c))
diff --git a/src/runtime/testdata/testprog/crash.go b/src/runtime/testdata/testprog/crash.go
index 4d83132..c4990cd 100644
--- a/src/runtime/testdata/testprog/crash.go
+++ b/src/runtime/testdata/testprog/crash.go
@@ -11,6 +11,7 @@
 
 func init() {
 	register("Crash", Crash)
+	register("DoublePanic", DoublePanic)
 }
 
 func test(name string) {
@@ -43,3 +44,23 @@
 	testInNewThread("second-new-thread")
 	test("main-again")
 }
+
+type P string
+
+func (p P) String() string {
+	// Try to free the "YYY" string header when the "XXX"
+	// panic is stringified.
+	runtime.GC()
+	runtime.GC()
+	runtime.GC()
+	return string(p)
+}
+
+// Test that panic message is not clobbered.
+// See issue 30150.
+func DoublePanic() {
+	defer func() {
+		panic(P("YYY"))
+	}()
+	panic(P("XXX"))
+}
diff --git a/src/runtime/testdata/testprog/gc.go b/src/runtime/testdata/testprog/gc.go
index fdf08be..ea6604f 100644
--- a/src/runtime/testdata/testprog/gc.go
+++ b/src/runtime/testdata/testprog/gc.go
@@ -18,6 +18,7 @@
 	register("GCFairness2", GCFairness2)
 	register("GCSys", GCSys)
 	register("GCPhys", GCPhys)
+	register("DeferLiveness", DeferLiveness)
 }
 
 func GCSys() {
@@ -207,3 +208,25 @@
 	fmt.Println("OK")
 	runtime.KeepAlive(saved)
 }
+
+// Test that defer closure is correctly scanned when the stack is scanned.
+func DeferLiveness() {
+	var x [10]int
+	escape(&x)
+	fn := func() {
+		if x[0] != 42 {
+			panic("FAIL")
+		}
+	}
+	defer fn()
+
+	x[0] = 42
+	runtime.GC()
+	runtime.GC()
+	runtime.GC()
+}
+
+//go:noinline
+func escape(x interface{}) { sink2 = x; sink2 = nil }
+
+var sink2 interface{}
diff --git a/src/runtime/testdata/testprog/memprof.go b/src/runtime/testdata/testprog/memprof.go
index a22fee6..7b134bc 100644
--- a/src/runtime/testdata/testprog/memprof.go
+++ b/src/runtime/testdata/testprog/memprof.go
@@ -21,7 +21,10 @@
 var memProfStr string
 
 func MemProf() {
-	for i := 0; i < 1000; i++ {
+	// Force heap sampling for determinism.
+	runtime.MemProfileRate = 1
+
+	for i := 0; i < 10; i++ {
 		fmt.Fprintf(&memProfBuf, "%*d\n", i, i)
 	}
 	memProfStr = memProfBuf.String()
diff --git a/src/runtime/treap_test.go b/src/runtime/treap_test.go
new file mode 100644
index 0000000..76e4829
--- /dev/null
+++ b/src/runtime/treap_test.go
@@ -0,0 +1,205 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package runtime_test
+
+import (
+	"runtime"
+	"testing"
+)
+
+var spanDesc = map[uintptr]uintptr{
+	0xc0000000: 2,
+	0xc0006000: 1,
+	0xc0010000: 8,
+	0xc0022000: 7,
+	0xc0034000: 4,
+	0xc0040000: 5,
+	0xc0050000: 5,
+	0xc0060000: 5000,
+}
+
+// Wrap the Treap one more time because go:notinheap doesn't
+// actually follow a structure across package boundaries.
+//
+//go:notinheap
+type treap struct {
+	runtime.Treap
+}
+
+// This test ensures that the treap implementation in the runtime
+// maintains all stated invariants after different sequences of
+// insert, removeSpan, find, and erase. Invariants specific to the
+// treap data structure are checked implicitly: after each mutating
+// operation, treap-related invariants are checked for the entire
+// treap.
+func TestTreap(t *testing.T) {
+	// Set up a bunch of spans allocated into mheap_.
+	spans := make([]runtime.Span, 0, len(spanDesc))
+	for base, pages := range spanDesc {
+		s := runtime.AllocSpan(base, pages)
+		defer s.Free()
+		spans = append(spans, s)
+	}
+	t.Run("Insert", func(t *testing.T) {
+		tr := treap{}
+		// Test just a very basic insert/remove for sanity.
+		tr.Insert(spans[0])
+		tr.RemoveSpan(spans[0])
+	})
+	t.Run("FindTrivial", func(t *testing.T) {
+		tr := treap{}
+		// Test just a very basic find operation for sanity.
+		tr.Insert(spans[0])
+		i := tr.Find(1)
+		if i.Span() != spans[0] {
+			t.Fatal("found unknown span in treap")
+		}
+		tr.RemoveSpan(spans[0])
+	})
+	t.Run("FindBestFit", func(t *testing.T) {
+		// Run this 10 times, recreating the treap each time.
+		// Because of the non-deterministic structure of a treap,
+		// we'll be able to test different structures this way.
+		for i := 0; i < 10; i++ {
+			tr := treap{}
+			for _, s := range spans {
+				tr.Insert(s)
+			}
+			i := tr.Find(5)
+			if i.Span().Pages() != 5 {
+				t.Fatalf("expected span of size 5, got span of size %d", i.Span().Pages())
+			} else if i.Span().Base() != 0xc0040000 {
+				t.Fatalf("expected span to have the lowest base address, instead got base %x", i.Span().Base())
+			}
+			for _, s := range spans {
+				tr.RemoveSpan(s)
+			}
+		}
+	})
+	t.Run("Iterate", func(t *testing.T) {
+		t.Run("StartToEnd", func(t *testing.T) {
+			// Ensure progressing an iterator actually goes over the whole treap
+			// from the start and that it iterates over the elements in order.
+			// Also ensures that Start returns a valid iterator.
+			tr := treap{}
+			for _, s := range spans {
+				tr.Insert(s)
+			}
+			nspans := 0
+			lastSize := uintptr(0)
+			for i := tr.Start(); i.Valid(); i = i.Next() {
+				nspans++
+				if lastSize > i.Span().Pages() {
+					t.Fatalf("not iterating in correct order: encountered size %d before %d", lastSize, i.Span().Pages())
+				}
+				lastSize = i.Span().Pages()
+			}
+			if nspans != len(spans) {
+				t.Fatal("failed to iterate forwards over full treap")
+			}
+			for _, s := range spans {
+				tr.RemoveSpan(s)
+			}
+		})
+		t.Run("EndToStart", func(t *testing.T) {
+			// Ensure progressing an iterator actually goes over the whole treap
+			// from the end and that it iterates over the elements in reverse
+			// order. Also ensures that End returns a valid iterator.
+			tr := treap{}
+			for _, s := range spans {
+				tr.Insert(s)
+			}
+			nspans := 0
+			lastSize := ^uintptr(0)
+			for i := tr.End(); i.Valid(); i = i.Prev() {
+				nspans++
+				if lastSize < i.Span().Pages() {
+					t.Fatalf("not iterating in correct order: encountered size %d before %d", lastSize, i.Span().Pages())
+				}
+				lastSize = i.Span().Pages()
+			}
+			if nspans != len(spans) {
+				t.Fatal("failed to iterate backwards over full treap")
+			}
+			for _, s := range spans {
+				tr.RemoveSpan(s)
+			}
+		})
+		t.Run("Prev", func(t *testing.T) {
+			// Test the iterator invariant that i.prev().next() == i.
+			tr := treap{}
+			for _, s := range spans {
+				tr.Insert(s)
+			}
+			i := tr.Start().Next().Next()
+			p := i.Prev()
+			if !p.Valid() {
+				t.Fatal("i.prev() is invalid")
+			}
+			if p.Next().Span() != i.Span() {
+				t.Fatal("i.prev().next() != i")
+			}
+			for _, s := range spans {
+				tr.RemoveSpan(s)
+			}
+		})
+		t.Run("Next", func(t *testing.T) {
+			// Test the iterator invariant that i.next().prev() == i.
+			tr := treap{}
+			for _, s := range spans {
+				tr.Insert(s)
+			}
+			i := tr.Start().Next().Next()
+			n := i.Next()
+			if !n.Valid() {
+				t.Fatal("i.next() is invalid")
+			}
+			if n.Prev().Span() != i.Span() {
+				t.Fatal("i.next().prev() != i")
+			}
+			for _, s := range spans {
+				tr.RemoveSpan(s)
+			}
+		})
+	})
+	t.Run("EraseOne", func(t *testing.T) {
+		// Test that erasing one iterator correctly retains
+		// all relationships between elements.
+		tr := treap{}
+		for _, s := range spans {
+			tr.Insert(s)
+		}
+		i := tr.Start().Next().Next().Next()
+		s := i.Span()
+		n := i.Next()
+		p := i.Prev()
+		tr.Erase(i)
+		if n.Prev().Span() != p.Span() {
+			t.Fatal("p, n := i.Prev(), i.Next(); n.prev() != p after i was erased")
+		}
+		if p.Next().Span() != n.Span() {
+			t.Fatal("p, n := i.Prev(), i.Next(); p.next() != n after i was erased")
+		}
+		tr.Insert(s)
+		for _, s := range spans {
+			tr.RemoveSpan(s)
+		}
+	})
+	t.Run("EraseAll", func(t *testing.T) {
+		// Test that erasing iterators actually removes nodes from the treap.
+		tr := treap{}
+		for _, s := range spans {
+			tr.Insert(s)
+		}
+		for i := tr.Start(); i.Valid(); {
+			n := i.Next()
+			tr.Erase(i)
+			i = n
+		}
+		if size := tr.Size(); size != 0 {
+			t.Fatalf("should have emptied out treap, %d spans left", size)
+		}
+	})
+}
diff --git a/src/sort/sort.go b/src/sort/sort.go
index 7282b26..dd5bb37 100644
--- a/src/sort/sort.go
+++ b/src/sort/sort.go
@@ -131,7 +131,7 @@
 		c--
 	}
 	// If hi-c<3 then there are duplicates (by property of median of nine).
-	// Let be a bit more conservative, and set border to 5.
+	// Let's be a bit more conservative, and set border to 5.
 	protect := hi-c < 5
 	if !protect && hi-c < (hi-lo)/4 {
 		// Lets test some points for equality to pivot
diff --git a/src/sync/atomic/doc.go b/src/sync/atomic/doc.go
index 7c007d7..108b76b 100644
--- a/src/sync/atomic/doc.go
+++ b/src/sync/atomic/doc.go
@@ -47,7 +47,8 @@
 //
 // On non-Linux ARM, the 64-bit functions use instructions unavailable before the ARMv6k core.
 //
-// On both ARM and x86-32, it is the caller's responsibility to arrange for 64-bit
+// On ARM, x86-32, and 32-bit MIPS,
+// it is the caller's responsibility to arrange for 64-bit
 // alignment of 64-bit words accessed atomically. The first word in a
 // variable or in an allocated struct, array, or slice can be relied upon to be
 // 64-bit aligned.
diff --git a/src/syscall/dll_windows.go b/src/syscall/dll_windows.go
index c57cd34..34925f7 100644
--- a/src/syscall/dll_windows.go
+++ b/src/syscall/dll_windows.go
@@ -28,7 +28,7 @@
 func Syscall15(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2 uintptr, err Errno)
 func Syscall18(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 uintptr) (r1, r2 uintptr, err Errno)
 func loadlibrary(filename *uint16) (handle uintptr, err Errno)
-func loadsystemlibrary(filename *uint16) (handle uintptr, err Errno)
+func loadsystemlibrary(filename *uint16, absoluteFilepath *uint16) (handle uintptr, err Errno)
 func getprocaddress(handle uintptr, procname *uint8) (proc uintptr, err Errno)
 
 // A DLL implements access to a single DLL.
@@ -37,6 +37,26 @@
 	Handle Handle
 }
 
+// We use this for computing the absolute path for system DLLs on systems
+// where SEARCH_SYSTEM32 is not available.
+var systemDirectoryPrefix string
+
+func init() {
+	n := uint32(MAX_PATH)
+	for {
+		b := make([]uint16, n)
+		l, e := getSystemDirectory(&b[0], n)
+		if e != nil {
+			panic("Unable to determine system directory: " + e.Error())
+		}
+		if l <= n {
+			systemDirectoryPrefix = UTF16ToString(b[:l]) + "\\"
+			break
+		}
+		n = l
+	}
+}
+
 // LoadDLL loads the named DLL file into memory.
 //
 // If name is not an absolute path and is not a known system DLL used by
@@ -53,7 +73,11 @@
 	var h uintptr
 	var e Errno
 	if sysdll.IsSystemDLL[name] {
-		h, e = loadsystemlibrary(namep)
+		absoluteFilepathp, err := UTF16PtrFromString(systemDirectoryPrefix + name)
+		if err != nil {
+			return nil, err
+		}
+		h, e = loadsystemlibrary(namep, absoluteFilepathp)
 	} else {
 		h, e = loadlibrary(namep)
 	}
diff --git a/src/syscall/security_windows.go b/src/syscall/security_windows.go
index ae8b3a1..db80d98 100644
--- a/src/syscall/security_windows.go
+++ b/src/syscall/security_windows.go
@@ -290,6 +290,7 @@
 //sys	OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken
 //sys	GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation
 //sys	GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW
+//sys	getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW
 
 // An access token contains the security information for a logon session.
 // The system creates an access token when a user logs on, and every
diff --git a/src/syscall/syscall_linux_test.go b/src/syscall/syscall_linux_test.go
index 293549a..8a57863 100644
--- a/src/syscall/syscall_linux_test.go
+++ b/src/syscall/syscall_linux_test.go
@@ -360,10 +360,23 @@
 		strconv.FormatUint(uint64(-uid), 10) + " / " +
 		strconv.FormatUint(uint64(uid), 10)
 	if got != want {
+		if filesystemIsNoSUID(tmpBinary) {
+			t.Skip("skipping test when temp dir is mounted nosuid")
+		}
 		t.Errorf("expected %s, got %s", want, got)
 	}
 }
 
+// filesystemIsNoSUID reports whether the filesystem for the given
+// path is mounted nosuid.
+func filesystemIsNoSUID(path string) bool {
+	var st syscall.Statfs_t
+	if syscall.Statfs(path, &st) != nil {
+		return false
+	}
+	return st.Flags&syscall.MS_NOSUID != 0
+}
+
 func syscallNoError() {
 	// Test that the return value from SYS_GETEUID32 (which cannot fail)
 	// doesn't get treated as an error (see https://golang.org/issue/22924)
diff --git a/src/syscall/zsyscall_windows.go b/src/syscall/zsyscall_windows.go
index de2d4f3..2348f65 100644
--- a/src/syscall/zsyscall_windows.go
+++ b/src/syscall/zsyscall_windows.go
@@ -190,6 +190,7 @@
 	procOpenProcessToken                   = modadvapi32.NewProc("OpenProcessToken")
 	procGetTokenInformation                = modadvapi32.NewProc("GetTokenInformation")
 	procGetUserProfileDirectoryW           = moduserenv.NewProc("GetUserProfileDirectoryW")
+	procGetSystemDirectoryW                = modkernel32.NewProc("GetSystemDirectoryW")
 )
 
 func GetLastError() (lasterr error) {
@@ -1916,3 +1917,16 @@
 	}
 	return
 }
+
+func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
+	r0, _, e1 := Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
+	len = uint32(r0)
+	if len == 0 {
+		if e1 != 0 {
+			err = errnoErr(e1)
+		} else {
+			err = EINVAL
+		}
+	}
+	return
+}
diff --git a/src/testing/sub_test.go b/src/testing/sub_test.go
index 8c98971..5a6d51b 100644
--- a/src/testing/sub_test.go
+++ b/src/testing/sub_test.go
@@ -706,6 +706,55 @@
 	}
 }
 
+// The late log message did not include the test name.  Issue 29388.
+func TestLogAfterComplete(t *T) {
+	ctx := newTestContext(1, newMatcher(regexp.MatchString, "", ""))
+	var buf bytes.Buffer
+	t1 := &T{
+		common: common{
+			// Use a buffered channel so that tRunner can write
+			// to it although nothing is reading from it.
+			signal: make(chan bool, 1),
+			w:      &buf,
+		},
+		context: ctx,
+	}
+
+	c1 := make(chan bool)
+	c2 := make(chan string)
+	tRunner(t1, func(t *T) {
+		t.Run("TestLateLog", func(t *T) {
+			go func() {
+				defer close(c2)
+				defer func() {
+					p := recover()
+					if p == nil {
+						c2 <- "subtest did not panic"
+						return
+					}
+					s, ok := p.(string)
+					if !ok {
+						c2 <- fmt.Sprintf("subtest panic with unexpected value %v", p)
+						return
+					}
+					const want = "Log in goroutine after TestLateLog has completed"
+					if !strings.Contains(s, want) {
+						c2 <- fmt.Sprintf("subtest panic %q does not contain %q", s, want)
+					}
+				}()
+
+				<-c1
+				t.Log("log after test")
+			}()
+		})
+	})
+	close(c1)
+
+	if s := <-c2; s != "" {
+		t.Error(s)
+	}
+}
+
 func TestBenchmark(t *T) {
 	res := Benchmark(func(b *B) {
 		for i := 0; i < 5; i++ {
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 0ac51b6..3068630 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -618,17 +618,20 @@
 func (c *common) logDepth(s string, depth int) {
 	c.mu.Lock()
 	defer c.mu.Unlock()
-	// If this test has already finished try and log this message with our parent
-	// with this test name tagged so we know where it came from.
-	// If we don't have a parent panic.
-	if c.done {
-		if c.parent != nil {
-			c.parent.logDepth(s, depth+1)
-		} else {
-			panic("Log in goroutine after " + c.name + " has completed")
-		}
-	} else {
+	if !c.done {
 		c.output = append(c.output, c.decorate(s, depth+1)...)
+	} else {
+		// This test has already finished. Try and log this message
+		// with our parent. If we don't have a parent, panic.
+		for parent := c.parent; parent != nil; parent = parent.parent {
+			parent.mu.Lock()
+			defer parent.mu.Unlock()
+			if !parent.done {
+				parent.output = append(parent.output, parent.decorate(s, depth+1)...)
+				return
+			}
+		}
+		panic("Log in goroutine after " + c.name + " has completed")
 	}
 }
 
diff --git a/src/text/template/exec.go b/src/text/template/exec.go
index c6ce657..76cce1f 100644
--- a/src/text/template/exec.go
+++ b/src/text/template/exec.go
@@ -576,6 +576,13 @@
 	}
 	typ := receiver.Type()
 	receiver, isNil := indirect(receiver)
+	if receiver.Kind() == reflect.Interface && isNil {
+		// Calling a method on a nil interface can't work. The
+		// MethodByName method call below would panic.
+		s.errorf("nil pointer evaluating %s.%s", typ, fieldName)
+		return zero
+	}
+
 	// Unless it's an interface, need to get to a value of type *T to guarantee
 	// we see all methods of T and *T.
 	ptr := receiver
diff --git a/src/text/template/exec_test.go b/src/text/template/exec_test.go
index bfd6d38..d0f7310 100644
--- a/src/text/template/exec_test.go
+++ b/src/text/template/exec_test.go
@@ -58,8 +58,10 @@
 	Empty3 interface{}
 	Empty4 interface{}
 	// Non-empty interfaces.
-	NonEmptyInterface    I
-	NonEmptyInterfacePtS *I
+	NonEmptyInterface         I
+	NonEmptyInterfacePtS      *I
+	NonEmptyInterfaceNil      I
+	NonEmptyInterfaceTypedNil I
 	// Stringer.
 	Str fmt.Stringer
 	Err error
@@ -141,24 +143,25 @@
 		{"one": 1, "two": 2},
 		{"eleven": 11, "twelve": 12},
 	},
-	Empty1:               3,
-	Empty2:               "empty2",
-	Empty3:               []int{7, 8},
-	Empty4:               &U{"UinEmpty"},
-	NonEmptyInterface:    &T{X: "x"},
-	NonEmptyInterfacePtS: &siVal,
-	Str:                  bytes.NewBuffer([]byte("foozle")),
-	Err:                  errors.New("erroozle"),
-	PI:                   newInt(23),
-	PS:                   newString("a string"),
-	PSI:                  newIntSlice(21, 22, 23),
-	BinaryFunc:           func(a, b string) string { return fmt.Sprintf("[%s=%s]", a, b) },
-	VariadicFunc:         func(s ...string) string { return fmt.Sprint("<", strings.Join(s, "+"), ">") },
-	VariadicFuncInt:      func(a int, s ...string) string { return fmt.Sprint(a, "=<", strings.Join(s, "+"), ">") },
-	NilOKFunc:            func(s *int) bool { return s == nil },
-	ErrFunc:              func() (string, error) { return "bla", nil },
-	PanicFunc:            func() string { panic("test panic") },
-	Tmpl:                 Must(New("x").Parse("test template")), // "x" is the value of .X
+	Empty1:                    3,
+	Empty2:                    "empty2",
+	Empty3:                    []int{7, 8},
+	Empty4:                    &U{"UinEmpty"},
+	NonEmptyInterface:         &T{X: "x"},
+	NonEmptyInterfacePtS:      &siVal,
+	NonEmptyInterfaceTypedNil: (*T)(nil),
+	Str:                       bytes.NewBuffer([]byte("foozle")),
+	Err:                       errors.New("erroozle"),
+	PI:                        newInt(23),
+	PS:                        newString("a string"),
+	PSI:                       newIntSlice(21, 22, 23),
+	BinaryFunc:                func(a, b string) string { return fmt.Sprintf("[%s=%s]", a, b) },
+	VariadicFunc:              func(s ...string) string { return fmt.Sprint("<", strings.Join(s, "+"), ">") },
+	VariadicFuncInt:           func(a int, s ...string) string { return fmt.Sprint(a, "=<", strings.Join(s, "+"), ">") },
+	NilOKFunc:                 func(s *int) bool { return s == nil },
+	ErrFunc:                   func() (string, error) { return "bla", nil },
+	PanicFunc:                 func() string { panic("test panic") },
+	Tmpl:                      Must(New("x").Parse("test template")), // "x" is the value of .X
 }
 
 var tSliceOfNil = []*T{nil}
@@ -365,6 +368,7 @@
 	{".NilOKFunc not nil", "{{call .NilOKFunc .PI}}", "false", tVal, true},
 	{".NilOKFunc nil", "{{call .NilOKFunc nil}}", "true", tVal, true},
 	{"method on nil value from slice", "-{{range .}}{{.Method1 1234}}{{end}}-", "-1234-", tSliceOfNil, true},
+	{"method on typed nil interface value", "{{.NonEmptyInterfaceTypedNil.Method0}}", "M0", tVal, true},
 
 	// Function call builtin.
 	{".BinaryFunc", "{{call .BinaryFunc `1` `2`}}", "[1=2]", tVal, true},
@@ -1492,6 +1496,11 @@
 			"{{call .PanicFunc}}", tVal,
 			`template: t:1:2: executing "t" at <call .PanicFunc>: error calling call: test panic`,
 		},
+		{
+			"method call on nil interface",
+			"{{.NonEmptyInterfaceNil.Method0}}", tVal,
+			`template: t:1:23: executing "t" at <.NonEmptyInterfaceNil.Method0>: nil pointer evaluating template.I.Method0`,
+		},
 	}
 	for _, tc := range tests {
 		b := new(bytes.Buffer)
diff --git a/test/chan/powser1.go b/test/chan/powser1.go
index 9386200..5357eec 100644
--- a/test/chan/powser1.go
+++ b/test/chan/powser1.go
@@ -11,7 +11,7 @@
 // coefficients.  A denominator of zero signifies the end.
 // Original code in Newsqueak by Doug McIlroy.
 // See Squinting at Power Series by Doug McIlroy,
-//   http://www.cs.bell-labs.com/who/rsc/thread/squint.pdf
+//   https://swtch.com/~rsc/thread/squint.pdf
 
 package main
 
diff --git a/test/chan/powser2.go b/test/chan/powser2.go
index 8fa3b7e..fb1fb85 100644
--- a/test/chan/powser2.go
+++ b/test/chan/powser2.go
@@ -15,7 +15,7 @@
 // coefficients.  A denominator of zero signifies the end.
 // Original code in Newsqueak by Doug McIlroy.
 // See Squinting at Power Series by Doug McIlroy,
-//   http://www.cs.bell-labs.com/who/rsc/thread/squint.pdf
+//   https://swtch.com/~rsc/thread/squint.pdf
 
 package main
 
diff --git a/test/checkbce.go b/test/checkbce.go
index a8f060a..6a12609 100644
--- a/test/checkbce.go
+++ b/test/checkbce.go
@@ -33,9 +33,7 @@
 
 	if 4 <= i && i < len(a) {
 		useInt(a[i])
-		useInt(a[i-1]) // ERROR "Found IsInBounds$"
-		// TODO: 'if 4 <= i && i < len(a)' gets rewritten to 'if uint(i - 4) < 256 - 4',
-		// which the bounds checker cannot yet use to infer that the next line doesn't need a bounds check.
+		useInt(a[i-1])
 		useInt(a[i-4])
 	}
 }
diff --git a/test/escape_because.go b/test/escape_because.go
index 3b67ff9..64fa28d 100644
--- a/test/escape_because.go
+++ b/test/escape_because.go
@@ -43,7 +43,7 @@
 	sink = &u // ERROR "&u escapes to heap$" "from &u \(interface-converted\) at escape_because.go:43$" "from sink \(assigned to top level variable\) at escape_because.go:43$"
 }
 
-func f3(r *int) interface{} { // ERROR "from \[\]\*int literal \(slice-literal-element\) at escape_because.go:47$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:48$" "leaking param: r to result ~r1 level=-1$"
+func f3(r *int) interface{} { // ERROR "from \[\]\*int literal \(slice-literal-element\) at escape_because.go:47$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:48$" "leaking param: r"
 	c := []*int{r} // ERROR "\[\]\*int literal escapes to heap$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:48$"
 	return c       // "return" // ERROR "c escapes to heap$" "from ~r1 \(return\) at escape_because.go:48$"
 }
diff --git a/test/escape_param.go b/test/escape_param.go
index dff13b6..175a4f0 100644
--- a/test/escape_param.go
+++ b/test/escape_param.go
@@ -424,3 +424,18 @@
 	Sink = g(y)
 	f(y)
 }
+
+// interface(in) -> out
+// See also issue 29353.
+
+// Convert to a non-direct interface, require an allocation and
+// copy x to heap (not to result).
+func param14a(x [4]*int) interface{} { // ERROR "leaking param: x$"
+	return x // ERROR "x escapes to heap"
+}
+
+// Convert to a direct interface, does not need an allocation.
+// So x only leaks to result.
+func param14b(x *int) interface{} { // ERROR "leaking param: x to result ~r1 level=0"
+	return x // ERROR "x escapes to heap"
+}
diff --git a/test/fixedbugs/issue27201.go b/test/fixedbugs/issue27201.go
new file mode 100644
index 0000000..0c9611f
--- /dev/null
+++ b/test/fixedbugs/issue27201.go
@@ -0,0 +1,37 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"runtime"
+	"strings"
+)
+
+func main() {
+	f(nil)
+}
+
+func f(p *int32) {
+	defer checkstack()
+	v := *p         // panic should happen here, line 20
+	sink = int64(v) // not here, line 21
+}
+
+var sink int64
+
+func checkstack() {
+	_ = recover()
+	var buf [1024]byte
+	n := runtime.Stack(buf[:], false)
+	s := string(buf[:n])
+	if strings.Contains(s, "issue27201.go:21 ") {
+		panic("panic at wrong location")
+	}
+	if !strings.Contains(s, "issue27201.go:20 ") {
+		panic("no panic at correct location")
+	}
+}
diff --git a/test/fixedbugs/issue29215.go b/test/fixedbugs/issue29215.go
index df703aa..4e8f107 100644
--- a/test/fixedbugs/issue29215.go
+++ b/test/fixedbugs/issue29215.go
@@ -16,3 +16,20 @@
         }
         _ = s == "bbb"
 }
+
+// Another case: load from negative offset of a symbol
+// in dead code (issue 30257).
+func g() {
+	var i int
+	var s string
+
+	if true {
+		s = "a"
+	}
+
+	if f := 0.0; -f < 0 {
+		i = len(s[:4])
+	}
+
+	_ = s[i-1:0] != "bb" && true
+}
diff --git a/test/fixedbugs/issue29610.dir/a.go b/test/fixedbugs/issue29610.dir/a.go
new file mode 100644
index 0000000..ccbe451
--- /dev/null
+++ b/test/fixedbugs/issue29610.dir/a.go
@@ -0,0 +1,15 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+type I interface {
+	M(init bool)
+}
+
+var V I
+
+func init() {
+	V = nil
+}
diff --git a/test/fixedbugs/issue29610.dir/b.go b/test/fixedbugs/issue29610.dir/b.go
new file mode 100644
index 0000000..c2016de
--- /dev/null
+++ b/test/fixedbugs/issue29610.dir/b.go
@@ -0,0 +1,17 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package b
+
+import "./a"
+
+type S struct {
+	a.I
+}
+
+var V a.I
+
+func init() {
+	V = S{}
+}
diff --git a/test/fixedbugs/issue29610.dir/main.go b/test/fixedbugs/issue29610.dir/main.go
new file mode 100644
index 0000000..29437bf
--- /dev/null
+++ b/test/fixedbugs/issue29610.dir/main.go
@@ -0,0 +1,11 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "./b"
+
+var v b.S
+
+func main() {}
diff --git a/test/fixedbugs/issue29610.go b/test/fixedbugs/issue29610.go
new file mode 100644
index 0000000..8d49ba6
--- /dev/null
+++ b/test/fixedbugs/issue29610.go
@@ -0,0 +1,13 @@
+// rundir
+
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 29610: Symbol import and initialization order caused function
+// symbols to be recorded as non-function symbols.
+
+// This uses rundir not because we actually want to run the final
+// binary, but because we need to at least link it.
+
+package ignored
diff --git a/test/fixedbugs/issue29735.go b/test/fixedbugs/issue29735.go
new file mode 100644
index 0000000..7a0381d
--- /dev/null
+++ b/test/fixedbugs/issue29735.go
@@ -0,0 +1,33 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Make sure FuncForPC won't panic when given a pc which
+// lies between two functions.
+
+package main
+
+import (
+	"runtime"
+)
+
+func main() {
+	var stack [1]uintptr
+	runtime.Callers(1, stack[:])
+	f() // inlined function, to give main some inlining info
+	for i := uintptr(0); true; i++ {
+		f := runtime.FuncForPC(stack[0] + i)
+		if f.Name() != "main.main" && f.Name() != "main.f" {
+			// Reached next function successfully.
+			break
+		}
+	}
+}
+
+func f() {
+	sink = 0 // one instruction which can't be removed
+}
+
+var sink int
diff --git a/test/fixedbugs/issue29870.go b/test/fixedbugs/issue29870.go
new file mode 100644
index 0000000..b79860c
--- /dev/null
+++ b/test/fixedbugs/issue29870.go
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Make sure we can compile "_" functions without crashing.
+
+package main
+
+import "log"
+
+func _() {
+	log.Println("%2F")
+}
diff --git a/test/fixedbugs/issue29870b.go b/test/fixedbugs/issue29870b.go
new file mode 100644
index 0000000..1bac566
--- /dev/null
+++ b/test/fixedbugs/issue29870b.go
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Make sure we're compiling "_" functions at least enough
+// to get to an error which is generated during walk.
+
+package main
+
+func _() {
+	x := 7 // ERROR "x declared and not used"
+}
diff --git a/test/fixedbugs/issue29919.dir/a.go b/test/fixedbugs/issue29919.dir/a.go
new file mode 100644
index 0000000..cfccc4a
--- /dev/null
+++ b/test/fixedbugs/issue29919.dir/a.go
@@ -0,0 +1,75 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Make sure tracebacks from initialization code are reported correctly.
+
+package a
+
+import (
+	"fmt"
+	"runtime"
+	"strings"
+)
+
+var x = f() // line 15
+
+func f() int {
+	var b [4096]byte
+	n := runtime.Stack(b[:], false) // line 19
+	s := string(b[:n])
+	var pcs [10]uintptr
+	n = runtime.Callers(1, pcs[:]) // line 22
+
+	// Check the Stack results.
+	if debug {
+		println(s)
+	}
+	if strings.Contains(s, "autogenerated") {
+		panic("autogenerated code in traceback")
+	}
+	if !strings.Contains(s, "a.go:15") {
+		panic("missing a.go:15")
+	}
+	if !strings.Contains(s, "a.go:19") {
+		panic("missing a.go:19")
+	}
+	if !strings.Contains(s, "a.init.ializers") {
+		panic("missing a.init.ializers")
+	}
+
+	// Check the CallersFrames results.
+	if debug {
+		iter := runtime.CallersFrames(pcs[:n])
+		for {
+			f, more := iter.Next()
+			fmt.Printf("%s %s:%d\n", f.Function, f.File, f.Line)
+			if !more {
+				break
+			}
+		}
+	}
+	iter := runtime.CallersFrames(pcs[:n])
+	f, more := iter.Next()
+	if f.Function != "a.f" || !strings.HasSuffix(f.File, "a.go") || f.Line != 22 {
+		panic(fmt.Sprintf("bad f %v\n", f))
+	}
+	if !more {
+		panic("traceback truncated after f")
+	}
+	f, more = iter.Next()
+	if f.Function != "a.init.ializers" || !strings.HasSuffix(f.File, "a.go") || f.Line != 15 {
+		panic(fmt.Sprintf("bad init.ializers %v\n", f))
+	}
+	if !more {
+		panic("traceback truncated after init.ializers")
+	}
+	f, _ = iter.Next()
+	if f.Function != "runtime.main" {
+		panic("runtime.main missing")
+	}
+
+	return 0
+}
+
+const debug = false
diff --git a/test/fixedbugs/issue29919.dir/main.go b/test/fixedbugs/issue29919.dir/main.go
new file mode 100644
index 0000000..3e99ca8
--- /dev/null
+++ b/test/fixedbugs/issue29919.dir/main.go
@@ -0,0 +1,10 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import _ "./a"
+
+func main() {
+}
diff --git a/test/fixedbugs/issue29919.go b/test/fixedbugs/issue29919.go
new file mode 100644
index 0000000..6d97592
--- /dev/null
+++ b/test/fixedbugs/issue29919.go
@@ -0,0 +1,9 @@
+// rundir
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Make sure tracebacks from initialization code are reported correctly.
+
+package ignored
diff --git a/test/fixedbugs/issue29943.go b/test/fixedbugs/issue29943.go
new file mode 100644
index 0000000..ff47de5
--- /dev/null
+++ b/test/fixedbugs/issue29943.go
@@ -0,0 +1,28 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Code was miscompiled on ppc64le due to incorrect zero-extension
+// that was CSE'd.
+
+package main
+
+//go:noinline
+func g(i uint64) uint64 {
+	return uint64(uint32(i))
+}
+
+var sink uint64
+
+func main() {
+	for i := uint64(0); i < 1; i++ {
+		i32 := int32(i - 1)
+		sink = uint64((uint32(i32) << 1) ^ uint32((i32 >> 31)))
+		x := g(uint64(i32))
+		if x != uint64(uint32(i32)) {
+			panic(x)
+		}
+	}
+}
diff --git a/test/fixedbugs/issue30041.go b/test/fixedbugs/issue30041.go
new file mode 100644
index 0000000..7d8a169
--- /dev/null
+++ b/test/fixedbugs/issue30041.go
@@ -0,0 +1,63 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 30041: copying results of a reflect-generated
+// call on stack should not have write barrier.
+
+package main
+
+import (
+	"reflect"
+	"runtime"
+	"unsafe"
+)
+
+var badPtr uintptr
+
+var sink []byte
+
+func init() {
+	// Allocate large enough to use largeAlloc.
+	b := make([]byte, 1<<16-1)
+	sink = b // force heap allocation
+	//  Any space between the object and the end of page is invalid to point to.
+	badPtr = uintptr(unsafe.Pointer(&b[len(b)-1])) + 1
+}
+
+type ft func() *int
+
+var fn ft
+
+func rf([]reflect.Value) []reflect.Value {
+	a := reflect.ValueOf((*int)(nil))
+	return []reflect.Value{a}
+}
+
+const N = 1000
+
+func main() {
+	fn = reflect.MakeFunc(reflect.TypeOf(fn), rf).Interface().(ft)
+
+	// Keep running GC so the write barrier is on.
+	go func() {
+		for i := 0; i < N; i++ {
+			runtime.GC()
+		}
+	}()
+
+	var x [10]uintptr
+	for i := range x {
+		x[i] = badPtr
+	}
+	for i := 0; i < N; i++ {
+		runtime.Gosched()
+		use(x) // prepare bad pointers on stack
+		fn()
+	}
+}
+
+//go:noinline
+func use([10]uintptr) {}
diff --git a/test/fixedbugs/issue30061.go b/test/fixedbugs/issue30061.go
new file mode 100644
index 0000000..5092b01
--- /dev/null
+++ b/test/fixedbugs/issue30061.go
@@ -0,0 +1,20 @@
+// compile
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Make sure we can linkname to memmove with an unsafe.Pointer argument.
+
+package p
+
+import "unsafe"
+
+//go:linkname memmove runtime.memmove
+func memmove(to, from unsafe.Pointer, n uintptr)
+
+var V1, V2 int
+
+func F() {
+	memmove(unsafe.Pointer(&V1), unsafe.Pointer(&V2), unsafe.Sizeof(int(0)))
+}
diff --git a/test/fixedbugs/issue30476.go b/test/fixedbugs/issue30476.go
new file mode 100644
index 0000000..a2147ec
--- /dev/null
+++ b/test/fixedbugs/issue30476.go
@@ -0,0 +1,30 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 30476: KeepAlive didn't keep stack object alive.
+
+package main
+
+import "runtime"
+
+func main() {
+	x := new([10]int)
+	runtime.SetFinalizer(x, func(*[10]int) { panic("FAIL: finalizer runs") })
+	p := &T{x, 0}
+	use(p)
+	runtime.GC()
+	runtime.GC()
+	runtime.GC()
+	runtime.KeepAlive(p)
+}
+
+type T struct {
+	x *[10]int
+	y int
+}
+
+//go:noinline
+func use(*T) {}
diff --git a/test/fixedbugs/issue30566a.go b/test/fixedbugs/issue30566a.go
new file mode 100644
index 0000000..5d736cc
--- /dev/null
+++ b/test/fixedbugs/issue30566a.go
@@ -0,0 +1,23 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "fmt"
+
+//go:noinline
+func ident(s string) string { return s }
+
+func returnSecond(x bool, s string) string { return s }
+
+func identWrapper(s string) string { return ident(s) }
+
+func main() {
+	got := returnSecond((false || identWrapper("bad") != ""), ident("good"))
+	if got != "good" {
+		panic(fmt.Sprintf("wanted \"good\", got \"%s\"", got))
+	}
+}
diff --git a/test/fixedbugs/issue30566b.go b/test/fixedbugs/issue30566b.go
new file mode 100644
index 0000000..92e0644
--- /dev/null
+++ b/test/fixedbugs/issue30566b.go
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"bytes"
+	"fmt"
+)
+
+func main() {
+	_, _ = false || g(1), g(2)
+	if !bytes.Equal(x, []byte{1, 2}) {
+		panic(fmt.Sprintf("wanted [1,2], got %v", x))
+	}
+}
+
+var x []byte
+
+//go:noinline
+func g(b byte) bool {
+	x = append(x, b)
+	return false
+}
diff --git a/test/fixedbugs/issue30956.go b/test/fixedbugs/issue30956.go
new file mode 100644
index 0000000..021e6c5
--- /dev/null
+++ b/test/fixedbugs/issue30956.go
@@ -0,0 +1,32 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Check for compile generated static data for literal
+// composite struct
+
+package main
+
+import "fmt"
+
+type X struct {
+	V interface{}
+
+	a int
+	b int
+	c int
+}
+
+func pr(x X) {
+	fmt.Println(x.V)
+}
+
+func main() {
+	pr(X{
+		V: struct {
+			A int
+		}{42},
+	})
+}
diff --git a/test/fixedbugs/issue30956.out b/test/fixedbugs/issue30956.out
new file mode 100644
index 0000000..04f25e8
--- /dev/null
+++ b/test/fixedbugs/issue30956.out
@@ -0,0 +1 @@
+{42}
diff --git a/test/fixedbugs/issue30977.go b/test/fixedbugs/issue30977.go
new file mode 100644
index 0000000..2ca040d
--- /dev/null
+++ b/test/fixedbugs/issue30977.go
@@ -0,0 +1,52 @@
+// run
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 30977: write barrier call clobbers volatile
+// value when there are multiple uses of the value.
+
+package main
+
+import "runtime"
+
+type T struct {
+	a, b, c, d, e string
+}
+
+//go:noinline
+func g() T {
+	return T{"a", "b", "c", "d", "e"}
+}
+
+//go:noinline
+func f() {
+	// The compiler optimizes this to direct copying
+	// the call result to both globals, with write
+	// barriers. The first write barrier call clobbers
+	// the result of g on stack.
+	X = g()
+	Y = X
+}
+
+var X, Y T
+
+const N = 1000
+
+func main() {
+	// Keep GC running so the write barrier is on.
+	go func() {
+		for {
+			runtime.GC()
+		}
+	}()
+
+	for i := 0; i < N; i++ {
+		runtime.Gosched()
+		f()
+		if X != Y {
+			panic("FAIL")
+		}
+	}
+}
diff --git a/test/fixedbugs/issue31252.dir/a.go b/test/fixedbugs/issue31252.dir/a.go
new file mode 100644
index 0000000..fa43150
--- /dev/null
+++ b/test/fixedbugs/issue31252.dir/a.go
@@ -0,0 +1,13 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+import "fmt"
+
+type IndexController struct{}
+
+func (this *IndexController) Index(m *string) {
+	fmt.Println(m)
+}
diff --git a/test/fixedbugs/issue31252.dir/b.go b/test/fixedbugs/issue31252.dir/b.go
new file mode 100644
index 0000000..9bfc0ff
--- /dev/null
+++ b/test/fixedbugs/issue31252.dir/b.go
@@ -0,0 +1,13 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package b
+
+import "fmt"
+
+type IndexController struct{}
+
+func (this *IndexController) Index(m *string) {
+	fmt.Println(m)
+}
diff --git a/test/fixedbugs/issue31252.dir/c.go b/test/fixedbugs/issue31252.dir/c.go
new file mode 100644
index 0000000..928c8ee
--- /dev/null
+++ b/test/fixedbugs/issue31252.dir/c.go
@@ -0,0 +1,26 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package c
+
+import (
+	"a"
+	"b"
+)
+
+type HandlerFunc func(*string)
+
+func RouterInit() {
+	//home API
+	homeIndex := &a.IndexController{}
+	GET("/home/index/index", homeIndex.Index)
+	//admin API
+	adminIndex := &b.IndexController{}
+	GET("/admin/index/index", adminIndex.Index)
+	return
+}
+
+func GET(path string, handlers ...HandlerFunc) {
+	return
+}
diff --git a/test/fixedbugs/issue31252.dir/main.go b/test/fixedbugs/issue31252.dir/main.go
new file mode 100644
index 0000000..25a7548
--- /dev/null
+++ b/test/fixedbugs/issue31252.dir/main.go
@@ -0,0 +1,11 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "c"
+
+func main() {
+	c.RouterInit()
+}
diff --git a/test/fixedbugs/issue31252.go b/test/fixedbugs/issue31252.go
new file mode 100644
index 0000000..973ae1d
--- /dev/null
+++ b/test/fixedbugs/issue31252.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ignored
diff --git a/test/live.go b/test/live.go
index a508947..e7134ec 100644
--- a/test/live.go
+++ b/test/live.go
@@ -572,7 +572,7 @@
 func f37() {
 	if (m33[byteptr()] == 0 || // ERROR "stack object .autotmp_[0-9]+ interface \{\}"
 		m33[byteptr()] == 0) && // ERROR "stack object .autotmp_[0-9]+ interface \{\}"
-		m33[byteptr()] == 0 { // ERROR "stack object .autotmp_[0-9]+ interface \{\}"
+		m33[byteptr()] == 0 {
 		printnl()
 		return
 	}
@@ -697,9 +697,10 @@
 
 func f42() {
 	var p, q, r int
-	f43([]*int{&p,&q,&r}) // ERROR "stack object .autotmp_[0-9]+ \[3\]\*int$"
-	f43([]*int{&p,&r,&q})
-	f43([]*int{&q,&p,&r})
+	f43([]*int{&p, &q, &r}) // ERROR "stack object .autotmp_[0-9]+ \[3\]\*int$"
+	f43([]*int{&p, &r, &q})
+	f43([]*int{&q, &p, &r})
 }
+
 //go:noescape
 func f43(a []*int)