Use the existing Value method to make it a bit shorter.
Change-Id: I47c4328b5241ab48b3490a04a3d93d4428f7b88c
Reviewed-on: https://go-review.googlesource.com/c/go/+/642735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
start, end = end, start
}
- if !(start.Op == OpConst8 || start.Op == OpConst16 || start.Op == OpConst32 || start.Op == OpConst64) {
+ if !start.isGenericIntConst() {
// if start is not a constant we would be winning nothing from inverting the loop
continue
}
- if end.Op == OpConst8 || end.Op == OpConst16 || end.Op == OpConst32 || end.Op == OpConst64 {
+ if end.isGenericIntConst() {
// TODO: if both start and end are constants we should rewrite such that the comparison
// is against zero and nxt is ++ or -- operation
// That means: