]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: finish GOEXPERIMENT=preemptibleloops repair
authorDavid Chase <drchase@google.com>
Fri, 23 Mar 2018 15:30:58 +0000 (11:30 -0400)
committerDavid Chase <drchase@google.com>
Mon, 26 Mar 2018 17:44:14 +0000 (17:44 +0000)
A newish check for branch-likely on single-successor blocks
caught a case where the preemption-check inserter was
setting "likely" on an unconditional branch.

Fixed by checking for that case before setting likely.

Also removed an overconservative restriction on parallel
compilation for GOEXPERIMENT=preemptibleloops; it works
fine, it is just another control-flow transformation.

Change-Id: I8e786e6281e0631cac8d80cff67bfb6402b4d225
Reviewed-on: https://go-review.googlesource.com/102317
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/ssa/loopreschedchecks.go

index e47b8a8a9c8a974c90141c9b2b7c56c038880418..33fbb90be422b46d18048bed416ee63ad8c4a15f 100644 (file)
@@ -1223,7 +1223,7 @@ func concurrentBackendAllowed() bool {
                return false
        }
        // TODO: Test and delete these conditions.
-       if objabi.Fieldtrack_enabled != 0 || objabi.Preemptibleloops_enabled != 0 || objabi.Clobberdead_enabled != 0 {
+       if objabi.Fieldtrack_enabled != 0 || objabi.Clobberdead_enabled != 0 {
                return false
        }
        // TODO: fix races and enable the following flags
index cc6cb529729b7ab8ffdd1222ed69e752826d7dd8..30ba1e9d660c944d8f176f8141445b8c913cded7 100644 (file)
@@ -179,7 +179,9 @@ func insertLoopReschedChecks(f *Func) {
                if p.i != 0 {
                        likely = BranchUnlikely
                }
-               bb.Likely = likely
+               if bb.Kind != BlockPlain { // backedges can be unconditional. e.g., if x { something; continue }
+                       bb.Likely = likely
+               }
 
                // rewrite edge to include reschedule check
                // existing edges: