]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: ignore RegKill ops for non-phi after phi check
authorThan McIntosh <thanm@google.com>
Tue, 14 Nov 2017 18:56:18 +0000 (13:56 -0500)
committerThan McIntosh <thanm@google.com>
Tue, 21 Nov 2017 18:14:52 +0000 (18:14 +0000)
Relax the 'phi after non-phi' SSA sanity check to allow
RegKill ops interspersed with phi ops in a block. This fixes
a sanity check failure when -dwarflocationlists is enabled.

Updates #22694.

Change-Id: Iaae604ab6f1a8b150664dd120003727a6fb2f698
Reviewed-on: https://go-review.googlesource.com/77610
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/check.go

index fad57970d01131ed0748dd2d83922302105851bc..d0d1a7b9129a6062aec070acbb4c2d5874bb7789 100644 (file)
@@ -456,11 +456,16 @@ func memCheck(f *Func) {
                for _, b := range f.Blocks {
                        seenNonPhi := false
                        for _, v := range b.Values {
-                               if v.Op == OpPhi {
+                               switch v.Op {
+                               case OpPhi:
                                        if seenNonPhi {
                                                f.Fatalf("phi after non-phi @ %s: %s", b, v)
                                        }
-                               } else {
+                               case OpRegKill:
+                                       if f.RegAlloc == nil {
+                                               f.Fatalf("RegKill seen before register allocation @ %s: %s", b, v)
+                                       }
+                               default:
                                        seenNonPhi = true
                                }
                        }