mirror of
				https://github.com/golang/go.git
				synced 2025-11-03 18:20:59 +00:00 
			
		
		
		
	for ..; ..; i++ {
 ...
}
We want to schedule the i++ late in the block, so that all other
uses of i in the block are scheduled first. That way, i++ can
happen in place in a register instead of requiring a temporary register.
Change-Id: Id777407c7e67a5ddbd8e58251099b0488138c0df
Reviewed-on: https://go-review.googlesource.com/c/go/+/672998
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
		
	
			
		
			
				
	
	
		
			17 lines
		
	
	
	
		
			309 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			309 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// asmcheck
 | 
						|
 | 
						|
// Copyright 2025 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 codegen
 | 
						|
 | 
						|
func f(n int) int {
 | 
						|
	r := 0
 | 
						|
	// arm64:-"MOVD\t R"
 | 
						|
	// amd64:-"LEAQ","INCQ"
 | 
						|
	for i := range n {
 | 
						|
		r += i
 | 
						|
	}
 | 
						|
	return r
 | 
						|
}
 |