]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: loop in disjoint OpOffPtr check
authorJosh Bleecher Snyder <josharian@gmail.com>
Sun, 28 Oct 2018 18:19:33 +0000 (11:19 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 6 Nov 2018 00:21:47 +0000 (00:21 +0000)
We collapse OpOffPtrs during generic rewrites.
However, we also use disjoint at the same time.
Instead of waiting for all OpOffPtrs to be collapsed
before the disjointness rules can kick in,
burrow through all OpOffPtrs immediately.

Change-Id: I60d0a70a9b4605b1817db7c4aab0c0d789651c90
Reviewed-on: https://go-review.googlesource.com/c/145206
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/rewrite.go

index ed5bce861e48b8a74a0b9576d5eba2a74f22b033..17d7cb341412b1c3acd2b1ba9891688c8c46facb 100644 (file)
@@ -542,7 +542,7 @@ func disjoint(p1 *Value, n1 int64, p2 *Value, n2 int64) bool {
        }
        baseAndOffset := func(ptr *Value) (base *Value, offset int64) {
                base, offset = ptr, 0
-               if base.Op == OpOffPtr {
+               for base.Op == OpOffPtr {
                        offset += base.AuxInt
                        base = base.Args[0]
                }