Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: address calculation before write barrier check #19853
Note the LEAQ instruction at offset 42. It is only used by the store at offset 69. We should move it to just before 69 so it only has to execute if write barriers are on.
The tighten pass is responsible for this kind of move, but unfortunately it runs before lowering. Before lowering there is a use of the LEAQ (at that time, an OffPtr) on both sides of the branch. It is used by the non-write-barrier store, but that use goes away during lowering because the OffPtr gets folded into the store.
Another tighten run after lowering would fix this, but that's an awfully big hammer.