mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/compile: make cse faster
It is one of the slowest compiler phases right now, and we run two of them. Instead of using a map to make the initial partition, use a sort. It is much less memory intensive. Do a few optimizations to avoid work for size-1 equivalence classes. Implement -N. Change-Id: I1d2d85d3771abc918db4dd7cc30b0b2d854b15e1 Reviewed-on: https://go-review.googlesource.com/19024 Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
7b773946c0
commit
6a96a2fe5a
10 changed files with 206 additions and 276 deletions
|
|
@ -316,6 +316,12 @@ func (s *regAllocState) assignReg(r register, v *Value, c *Value) {
|
|||
fmt.Printf("assignReg %s %s/%s\n", registers[r].Name(), v, c)
|
||||
}
|
||||
if s.regs[r].v != nil {
|
||||
if v.Op == OpSB && !v.Block.Func.Config.optimize {
|
||||
// Rewrite rules may introduce multiple OpSB, and with
|
||||
// -N they don't get CSEd. Ignore the extra assignments.
|
||||
s.f.setHome(c, ®isters[r])
|
||||
return
|
||||
}
|
||||
s.f.Fatalf("tried to assign register %d to %s/%s but it is already used by %s", r, v, c, s.regs[r].v)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue