[release-branch.go1.21] cmd/compile: reset memcombine correctly between basic blocks

Not sure why this bug didn't cause a complete failure, but it
certainly makes for doing a lot more work than is necessary.

Fixes #62668

Change-Id: If0be4acb6eafc3d7eeb42d2f4263c21b4e6e1c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/527699
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
(cherry picked from commit 08cdfd06ed1ca21f3b8c95361506ab94c429b622)
Reviewed-on: https://go-review.googlesource.com/c/go/+/528795
Reviewed-by: Keith Randall <khr@google.com>
diff --git a/src/cmd/compile/internal/ssa/memcombine.go b/src/cmd/compile/internal/ssa/memcombine.go
index b2c5fe3..c134643 100644
--- a/src/cmd/compile/internal/ssa/memcombine.go
+++ b/src/cmd/compile/internal/ssa/memcombine.go
@@ -41,6 +41,7 @@
 		}
 	}
 	for _, b := range f.Blocks {
+		order = order[:0]
 		for _, v := range b.Values {
 			if v.Op != OpOr16 && v.Op != OpOr32 && v.Op != OpOr64 {
 				continue