cmd/compile: use a counter to track whether writebarrier rewriting is done
cmd/compile: use a counter to track whether writebarrier rewriting is done

Use a counter, instead of a loop, to see whether there are more
writebarrier ops in the current block that need to be rewritten.

No visible change in normal compiler speed benchmarks.

Passes toolstash -cmp on std cmd.

Fixes #20416.

Change-Id: Ifbbde23611cd668c35b8a4a3e9a92726bfe19956
Reviewed-on: https://go-review.googlesource.com/60310
Reviewed-by: David Chase <ae171625adc8645b8b79b7e405a6da5aba5341e0@google.com>

Cofyc/go,josharian/go,akutz/go,golang/go,cloudflare/go,golang/go,golang/go,cloudflare/go,Cofyc/go,codestation/go,cloudflare/go,polyverse-security/go,nawawi/go,nawawi/go,josharian/go,golang/go,golang/go,josharian/go,nawawi/go,CAFxX/go,CAFxX/go,nawawi/go,CAFxX/go,Cofyc/go,CAFxX/go,josharian/go,nawawi/go,cloudflare/go,akutz/go,cloudflare/go,polyverse-security/go,codestation/go,akutz/go,akutz/go,golang/go,polyverse-security/go,josharian/go,akutz/go,codestation/go,nawawi/go,josharian/go,polyverse-security/go,codestation/go,akutz/go,cloudflare/go,polyverse-security/go,golang/go,codestation/go,cloudflare/go,CAFxX/go,nawawi/go,codestation/go,Cofyc/go,Cofyc/go,codestation/go,akutz/go,CAFxX/go,josharian/go,akutz/go,cloudflare/go,CAFxX/go,Cofyc/go,golang/go,CAFxX/go,polyverse-security/go,Cofyc/go,christopher-henderson/Go,polyverse-security/go,nawawi/go,codestation/go,polyverse-security/go,Cofyc/go,josharian/go