aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/loopbce.go
diff options
context:
space:
mode:
authorGiovanni Bajo <rasky@develer.com>2018-04-02 03:17:18 +0200
committerGiovanni Bajo <rasky@develer.com>2018-04-29 09:38:09 +0000
commit980fdb8dd5fe0151a9b7e84ec6b8c20a11727521 (patch)
tree5823ed517bf407ba67c8a501c59430e8d4a14706 /src/cmd/compile/internal/ssa/loopbce.go
parentf49369b67ce8858f5f7ac4e41580e62a289d73df (diff)
downloadgo-980fdb8dd5fe0151a9b7e84ec6b8c20a11727521.tar.gz
go-980fdb8dd5fe0151a9b7e84ec6b8c20a11727521.zip
cmd/compile: improve testing of induction variables
Test both minimum and maximum bound, and prepare formatting for more advanced tests (inclusive / esclusive bounds). Change-Id: Ibe432916d9c938343bc07943798bc9709ad71845 Reviewed-on: https://go-review.googlesource.com/104040 Run-TryBot: Giovanni Bajo <rasky@develer.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/loopbce.go')
-rw-r--r--src/cmd/compile/internal/ssa/loopbce.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/ssa/loopbce.go b/src/cmd/compile/internal/ssa/loopbce.go
index 0ad274fc07..403aed6b20 100644
--- a/src/cmd/compile/internal/ssa/loopbce.go
+++ b/src/cmd/compile/internal/ssa/loopbce.go
@@ -1,5 +1,7 @@
package ssa
+import "fmt"
+
type indVar struct {
ind *Value // induction variable
inc *Value // increment, a constant
@@ -138,11 +140,22 @@ nextb:
}
if f.pass.debug >= 1 {
- if min.Op == OpConst64 {
- b.Func.Warnl(b.Pos, "Induction variable with minimum %d and increment %d", min.AuxInt, inc.AuxInt)
- } else {
- b.Func.Warnl(b.Pos, "Induction variable with non-const minimum and increment %d", inc.AuxInt)
+ mlim1, mlim2 := fmt.Sprint(min.AuxInt), fmt.Sprint(max.AuxInt)
+ if !min.isGenericIntConst() {
+ if f.pass.debug >= 2 {
+ mlim1 = fmt.Sprint(min)
+ } else {
+ mlim1 = "?"
+ }
+ }
+ if !max.isGenericIntConst() {
+ if f.pass.debug >= 2 {
+ mlim2 = fmt.Sprint(max)
+ } else {
+ mlim2 = "?"
+ }
}
+ b.Func.Warnl(b.Pos, "Induction variable: limits [%v,%v), increment %d", mlim1, mlim2, inc.AuxInt)
}
iv = append(iv, indVar{