mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/ssa: fix endless compile loop on AMD64
We currently rewrite (TESTQ (MOVQconst [c] x)) into (TESTQconst [c] x) and (TESTQconst [-1] x) into (TESTQ x x) if x is a (MOVQconst [-1]) we will be stuck in the endless rewrite loop. Don't perform the rewrite in such cases. Fixes #25006 Change-Id: I77f561ba2605fc104f1e5d5c57f32e9d67a2c000 Reviewed-on: https://go-review.googlesource.com/108879 Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
cd037bce09
commit
fb017c60bc
3 changed files with 50 additions and 8 deletions
30
test/fixedbugs/issue25006.go
Normal file
30
test/fixedbugs/issue25006.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// compile
|
||||
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package p
|
||||
|
||||
func spin() {
|
||||
var i int
|
||||
var b bool
|
||||
|
||||
switch 1 {
|
||||
case 0:
|
||||
i = 1
|
||||
}
|
||||
switch 1 {
|
||||
case i:
|
||||
default:
|
||||
i = 1
|
||||
b = !b && (b && !b) && b
|
||||
}
|
||||
switch false {
|
||||
case false:
|
||||
i = 3 + -i
|
||||
switch 0 {
|
||||
case 1 - i:
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue