]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove bug workarounds in prove's loop inversion
authorJorropo <jorropo.pgm@gmail.com>
Sat, 3 Feb 2024 08:06:30 +0000 (09:06 +0100)
committerGopher Robot <gobot@golang.org>
Mon, 4 Mar 2024 17:30:21 +0000 (17:30 +0000)
I wrote theses checks because I got bad panics on some innocent functions,
turns out I was working around #63955 but I was not aware of that at the time.

The proper fix was included in CL 539977 this is now doing nothing.

Change-Id: I89329329933527b6f3cb817dc1e039a38f58da9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/560975
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/compile/internal/ssa/prove.go

index 842719fb4c9820f57a1a8bbe24c53fc8c9be0a0c..761b77a05d894ea0cfbf242cbf6074c3506a352b 100644 (file)
@@ -878,34 +878,17 @@ func prove(f *Func) {
                        continue
                }
 
-               header := ind.Block
-               check := header.Controls[0]
-               if check == nil {
-                       // we don't know how to rewrite a loop that not simple comparison
-                       continue
-               }
-               switch check.Op {
-               case OpLeq64, OpLeq32, OpLeq16, OpLeq8,
-                       OpLess64, OpLess32, OpLess16, OpLess8:
-               default:
-                       // we don't know how to rewrite a loop that not simple comparison
-                       continue
-               }
-               if !((check.Args[0] == ind && check.Args[1] == end) ||
-                       (check.Args[1] == ind && check.Args[0] == end)) {
-                       // we don't know how to rewrite a loop that not simple comparison
-                       continue
-               }
                if end.Block == ind.Block {
                        // we can't rewrite loops where the condition depends on the loop body
                        // this simple check is forced to work because if this is true a Phi in ind.Block must exists
                        continue
                }
 
+               check := ind.Block.Controls[0]
                // invert the check
                check.Args[0], check.Args[1] = check.Args[1], check.Args[0]
 
-               // invert start and end in the loop
+               // swap start and end in the loop
                for i, v := range check.Args {
                        if v != end {
                                continue