You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is being done to clear the storage (LoweredZero). Looks like the LoweredZero generates the last ADD of -8 to make the stdu work correctly. Perhaps that can't be combined because it is part of the LoweredZero, although I don't understand why the first two aren't combined.
The add of -8 is done during ssa->prog so it can't be optimized away by SSA. The -8 is done there because if it was explicit in the SSA form, it would generate a pointer outside the bounds of the object it was pointing to. We can't let the GC see such a pointer.
Ooops I should have checked that first! It looks fine now except for the unnecessary add of -8, but I understand the reason why that can't go away. So this can be closed?
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?gotip
What operating system and processor architecture are you using (
go env
)?Ubuntu 16.04 ppc64le
What did you do?
Compiled a simple testcase using arrays declared on the stack, then looked at an objdump.
package main
arrtest1.go.txt
What did you expect to see?
Efficient generated code.
What did you see instead?
Opportunities for improvement.
11024: 00 01 61 38 addi r3,r1,256
11028: 98 00 83 38 addi r4,r3,152
1102c: f8 ff 63 38 addi r3,r3,-8
11030: 09 00 03 f8 stdu r0,8(r3)
Instead of 3 addi, the constant values could all be combined and a single addi used:
addi r3,r1,400 // 256+152-8
I know this might be due to the way I wrote this rule.
The text was updated successfully, but these errors were encountered: