/ go Public
cmd/compile: missed add+load combination opportunity #42672
Issues related to the Go compiler and/or runtime.
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Generates for the inner loop
There's no reason we couldn't do
ADDQ (AX)(DX*8), BXinstead of the MOVQ/ADDQ combo.
There's actually code that does this combining optimization in the compiler, but it doesn't trigger. The difficulty is that the combined ADDQ instruction will clobber its input, so we don't combine when the non-load argument to the ADDQ is used somewhere else (see
rewrite.go:canMergeLoadClobber). In this case the other use of BX is at the return statement. But that use shouldn't stop the optimization from happening, as it is in a separate branch. At the actual point where we're doing the optimization, the old value of BX is dead.
The text was updated successfully, but these errors were encountered: