Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: merge temporaries more aggressively #8740
CL 12829043 added a compiler pass that merges temporary variables with equal types and non-overlapping lifetimes. I believe that "equal types" is sufficient but not necessary and that "equivalent w.r.t. GC" is both necessary and sufficient. (Please correct me if I am wrong!) This should allow more temporaries to be merged, further reducing stack usage.
I took a quick hack at this. It does appear to offer some nice stack use wins, but it breaks our dwarf generation. Also,
My ugly hack code: https://github.com/josharian/go/compare/issue-8740. From the commit message there:
added a commit
May 26, 2015
changed the title from
cmd/gc: merge temporaries more aggressively
cmd/compile: merge temporaries more aggressively
Jun 8, 2015
I did. My recollection (now fuzzy) is that it helped but not enough to inspire me to finish re-implementing it.
I'll also admit to being a bit confused at the moment about the relationship between the stackalloc pass and the temporary merging code found in pgen.go. I've implemented this independently in both places, but never tried applying it to both at the same time.