regexp/syntax: append patchLists in constant time
regexp/syntax: append patchLists in constant time

By keeping a tail pointer, we can append to a patchList in constant
time, rather than in time proportional to the length of the list. This
gets rid of the quadratic compile times we were seeing for long series
of alternations.

This is basically the same change as
https://github.com/google/re2/commit/e9d517989f66f2e0a24cde42f4d2424dd3e4a9b9.

Fixes #39542.

Change-Id: Ib4ca0ca9c55abd1594df1984653c7d311ccf7572
Reviewed-on: https://go-review.googlesource.com/c/go/+/238079
Run-TryBot: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>

cloudflare/go,CAFxX/go,golang/go,nawawi/go,golang/go,cloudflare/go,nawawi/go,golang/go,cloudflare/go,nawawi/go,golang/go,cloudflare/go,cloudflare/go,CAFxX/go,CAFxX/go,CAFxX/go,nawawi/go,golang/go,nawawi/go,CAFxX/go,golang/go,nawawi/go,golang/go,cloudflare/go,golang/go,CAFxX/go,CAFxX/go,cloudflare/go,nawawi/go,CAFxX/go,cloudflare/go,nawawi/go