]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/ssa/loopbce.go
cmd/compile: fix findIndVar so it does not match disjointed loop headers
[gostls13.git] / src / cmd / compile / internal / ssa / loopbce.go
index 3dbd7350ae9da37fe92319bb8ed3e671b83cb161..dd1f39dbef74398f7cf9e338d26d6f9b1a8f4ca7 100644 (file)
@@ -129,6 +129,13 @@ func findIndVar(f *Func) []indVar {
                        less = false
                }
 
+               if ind.Block != b {
+                       // TODO: Could be extended to include disjointed loop headers.
+                       // I don't think this is causing missed optimizations in real world code often.
+                       // See https://go.dev/issue/63955
+                       continue
+               }
+
                // Expect the increment to be a nonzero constant.
                if !inc.isGenericIntConst() {
                        continue