cmd/compile: sparse conditional constant propagation

sparse conditional constant propagation can discover optimization opportunities that cannot be found by just combining constant folding and constant propagation and dead code elimination separately.

Updates #59399

Change-Id: Ia954e906480654a6f0cc065d75b5912f96f36b2e
GitHub-Last-Rev: 90fc02db99
GitHub-Pull-Request: golang/go#59575
Reviewed-on: https://go-review.googlesource.com/c/go/+/483875
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
This commit is contained in:
Yi Yang
2023-05-18 11:17:11 +00:00
committed by Keith Randall
parent e7a9ca0a53
commit fa50248ce6
8 changed files with 713 additions and 20 deletions

View File

@@ -35,12 +35,12 @@ func si64x8() {
}
// s390x:"CGIJ\t[$]2, R[0-9]+, [$]127, "
for i := int64(0); i >= 128; i++ {
for i := int64(129); i >= 128; i-- {
dummy()
}
// s390x:"CGIJ\t[$]4, R[0-9]+, [$]-128, "
for i := int64(0); i <= -129; i-- {
for i := int64(-130); i <= -129; i++ {
dummy()
}
}
@@ -71,7 +71,7 @@ func ui64x8() {
}
// s390x:"CLGIJ\t[$]2, R[0-9]+, [$]255, "
for i := uint64(0); i >= 256; i-- {
for i := uint64(257); i >= 256; i-- {
dummy()
}
@@ -107,12 +107,12 @@ func si32x8() {
}
// s390x:"CIJ\t[$]2, R[0-9]+, [$]127, "
for i := int32(0); i >= 128; i++ {
for i := int32(129); i >= 128; i-- {
dummy()
}
// s390x:"CIJ\t[$]4, R[0-9]+, [$]-128, "
for i := int32(0); i <= -129; i-- {
for i := int32(-130); i <= -129; i++ {
dummy()
}
}
@@ -143,7 +143,7 @@ func ui32x8() {
}
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]255, "
for i := uint32(0); i >= 256; i-- {
for i := uint32(257); i >= 256; i-- {
dummy()
}