mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: make loop finder more aware of irreducible loops
The loop finder doesn't return good information if it encounters an irreducible loop. Make a start on improving this, and set a function-level flag to indicate when there is such a loop (and the returned information might be flaky). Use that flag to prevent the loop rotater from getting confused; the existing code seems to depend on artifacts of the previous loop-finding algorithm. (There is one irreducible loop in the go library, in "inflate.go"). Change-Id: If6e26feab38d9b009d2252d556e1470c803bde40 Reviewed-on: https://go-review.googlesource.com/42150 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
acdb44765d
commit
9e21e9c5cb
3 changed files with 44 additions and 19 deletions
|
|
@ -23,6 +23,9 @@ package ssa
|
|||
// JLT loop
|
||||
func loopRotate(f *Func) {
|
||||
loopnest := f.loopnest()
|
||||
if loopnest.hasIrreducible {
|
||||
return
|
||||
}
|
||||
if len(loopnest.loops) == 0 {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue