diff options
Diffstat (limited to 'src/cmd/compile/internal')
| -rw-r--r-- | src/cmd/compile/internal/ssa/loopbce.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/loopbce.go b/src/cmd/compile/internal/ssa/loopbce.go index 0c09de0bfc..2ab05711ad 100644 --- a/src/cmd/compile/internal/ssa/loopbce.go +++ b/src/cmd/compile/internal/ssa/loopbce.go @@ -1,3 +1,7 @@ +// 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 ssa import "fmt" @@ -154,7 +158,7 @@ nextb: // if the increment is ±1 or when the limits are constants. if inc.AuxInt != 1 && inc.AuxInt != -1 { ok := false - if min.Op == OpConst64 && max.Op == OpConst64 { + if min.Op == OpConst64 && max.Op == OpConst64 && inc.AuxInt != 0 { if max.AuxInt > min.AuxInt && max.AuxInt%inc.AuxInt == min.AuxInt%inc.AuxInt { // handle overflow ok = true } |
