Skip to content

Commit 5c40210

Browse files
committed
cmd/compile: in prove, add transitive closure of relations
Implement it through a partial order datastructure, which keeps the relations between SSA values in a forest of DAGs and is able to discover contradictions. In make.bash, this patch is able to prove hundreds of conditions which were not proved before. Compilebench: name old time/op new time/op delta Template 371ms ± 2% 368ms ± 1% ~ (p=0.222 n=5+5) Unicode 203ms ± 6% 199ms ± 3% ~ (p=0.421 n=5+5) GoTypes 1.17s ± 4% 1.18s ± 1% ~ (p=0.151 n=5+5) Compiler 5.54s ± 2% 5.59s ± 1% ~ (p=0.548 n=5+5) SSA 12.9s ± 2% 13.2s ± 1% +2.96% (p=0.032 n=5+5) Flate 245ms ± 2% 247ms ± 3% ~ (p=0.690 n=5+5) GoParser 302ms ± 6% 302ms ± 4% ~ (p=0.548 n=5+5) Reflect 764ms ± 4% 773ms ± 3% ~ (p=0.095 n=5+5) Tar 354ms ± 6% 361ms ± 3% ~ (p=0.222 n=5+5) XML 434ms ± 3% 429ms ± 1% ~ (p=0.421 n=5+5) StdCmd 22.6s ± 1% 22.9s ± 1% +1.40% (p=0.032 n=5+5) name old user-time/op new user-time/op delta Template 436ms ± 8% 426ms ± 5% ~ (p=0.579 n=5+5) Unicode 219ms ±15% 219ms ±12% ~ (p=1.000 n=5+5) GoTypes 1.47s ± 6% 1.53s ± 6% ~ (p=0.222 n=5+5) Compiler 7.26s ± 4% 7.40s ± 2% ~ (p=0.389 n=5+5) SSA 17.7s ± 4% 18.5s ± 4% +4.13% (p=0.032 n=5+5) Flate 257ms ± 5% 268ms ± 9% ~ (p=0.333 n=5+5) GoParser 354ms ± 6% 348ms ± 6% ~ (p=0.913 n=5+5) Reflect 904ms ± 2% 944ms ± 4% ~ (p=0.056 n=5+5) Tar 398ms ±11% 430ms ± 7% ~ (p=0.079 n=5+5) XML 501ms ± 7% 489ms ± 5% ~ (p=0.444 n=5+5) name old text-bytes new text-bytes delta HelloSize 670kB ± 0% 670kB ± 0% +0.00% (p=0.008 n=5+5) CmdGoSize 7.22MB ± 0% 7.21MB ± 0% -0.07% (p=0.008 n=5+5) name old data-bytes new data-bytes delta HelloSize 9.88kB ± 0% 9.88kB ± 0% ~ (all equal) CmdGoSize 248kB ± 0% 248kB ± 0% -0.06% (p=0.008 n=5+5) name old bss-bytes new bss-bytes delta HelloSize 125kB ± 0% 125kB ± 0% ~ (all equal) CmdGoSize 145kB ± 0% 144kB ± 0% -0.20% (p=0.008 n=5+5) name old exe-bytes new exe-bytes delta HelloSize 1.43MB ± 0% 1.43MB ± 0% ~ (all equal) CmdGoSize 14.5MB ± 0% 14.5MB ± 0% -0.06% (p=0.008 n=5+5) Fixes #19714 Updates #20393 Change-Id: Ia090f5b5dc1bcd274ba8a39b233c1e1ace1b330e Reviewed-on: https://go-review.googlesource.com/100277 Run-TryBot: Giovanni Bajo <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 5af0b28 commit 5c40210

File tree

5 files changed

+1987
-51
lines changed

5 files changed

+1987
-51
lines changed

src/cmd/compile/fmt_test.go

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ var knownFormats = map[string]string{
610610
"[]cmd/compile/internal/ssa.ID %v": "",
611611
"[]cmd/compile/internal/syntax.token %s": "",
612612
"[]string %v": "",
613+
"[]uint32 %v": "",
613614
"bool %v": "",
614615
"byte %08b": "",
615616
"byte %c": "",
@@ -645,6 +646,8 @@ var knownFormats = map[string]string{
645646
"cmd/compile/internal/ssa.Op %s": "",
646647
"cmd/compile/internal/ssa.Op %v": "",
647648
"cmd/compile/internal/ssa.ValAndOff %s": "",
649+
"cmd/compile/internal/ssa.posetNode %v": "",
650+
"cmd/compile/internal/ssa.posetTestOp %v": "",
648651
"cmd/compile/internal/ssa.rbrank %d": "",
649652
"cmd/compile/internal/ssa.regMask %d": "",
650653
"cmd/compile/internal/ssa.register %d": "",
@@ -693,31 +696,32 @@ var knownFormats = map[string]string{
693696
"interface{} %s": "",
694697
"interface{} %v": "",
695698
"map[*cmd/compile/internal/gc.Node]*cmd/compile/internal/ssa.Value %v": "",
696-
"reflect.Type %s": "",
697-
"rune %#U": "",
698-
"rune %c": "",
699-
"string %-*s": "",
700-
"string %-16s": "",
701-
"string %-6s": "",
702-
"string %.*s": "",
703-
"string %q": "",
704-
"string %s": "",
705-
"string %v": "",
706-
"time.Duration %d": "",
707-
"time.Duration %v": "",
708-
"uint %04x": "",
709-
"uint %5d": "",
710-
"uint %d": "",
711-
"uint %x": "",
712-
"uint16 %d": "",
713-
"uint16 %v": "",
714-
"uint16 %x": "",
715-
"uint32 %d": "",
716-
"uint32 %x": "",
717-
"uint64 %08x": "",
718-
"uint64 %d": "",
719-
"uint64 %x": "",
720-
"uint8 %d": "",
721-
"uint8 %x": "",
722-
"uintptr %d": "",
699+
"map[cmd/compile/internal/ssa.ID]uint32 %v": "",
700+
"reflect.Type %s": "",
701+
"rune %#U": "",
702+
"rune %c": "",
703+
"string %-*s": "",
704+
"string %-16s": "",
705+
"string %-6s": "",
706+
"string %.*s": "",
707+
"string %q": "",
708+
"string %s": "",
709+
"string %v": "",
710+
"time.Duration %d": "",
711+
"time.Duration %v": "",
712+
"uint %04x": "",
713+
"uint %5d": "",
714+
"uint %d": "",
715+
"uint %x": "",
716+
"uint16 %d": "",
717+
"uint16 %v": "",
718+
"uint16 %x": "",
719+
"uint32 %d": "",
720+
"uint32 %x": "",
721+
"uint64 %08x": "",
722+
"uint64 %d": "",
723+
"uint64 %x": "",
724+
"uint8 %d": "",
725+
"uint8 %x": "",
726+
"uintptr %d": "",
723727
}

0 commit comments

Comments
 (0)