Skip to content

Commit 0b3d39c

Browse files
committed
cmd/compile: don't run gc/ssa_test/TestGenFlowGraph in short mode
The test runs far too long for -short mode (4 seconds). Also removed useless test of now-disconnected knob (GO_SSA_PHI_LOC_CUTOFF), which cuts 4 seconds to 2 seconds (which is still too long), and finished removing the disconnected knob. Updates #26469. Change-Id: I6c594227c4a5aaffee46832049bdbbf570d86e60 Reviewed-on: https://go-review.googlesource.com/125075 Run-TryBot: David Chase <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent ad705ba commit 0b3d39c

File tree

2 files changed

+29
-50
lines changed

2 files changed

+29
-50
lines changed

src/cmd/compile/internal/gc/ssa_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"os"
1212
"os/exec"
1313
"path/filepath"
14-
"runtime"
1514
"strings"
1615
"testing"
1716
)
@@ -99,10 +98,10 @@ func runGenTest(t *testing.T, filename, tmpname string, ev ...string) {
9998
}
10099

101100
func TestGenFlowGraph(t *testing.T) {
102-
runGenTest(t, "flowgraph_generator1.go", "ssa_fg_tmp1")
103-
if runtime.GOOS != "windows" {
104-
runGenTest(t, "flowgraph_generator1.go", "ssa_fg_tmp2", "GO_SSA_PHI_LOC_CUTOFF=0")
101+
if testing.Short() {
102+
t.Skip("not run in short mode.")
105103
}
104+
runGenTest(t, "flowgraph_generator1.go", "ssa_fg_tmp1")
106105
}
107106

108107
// TestShortCircuit tests OANDAND and OOROR expressions and short circuiting.

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

+26-46
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,37 @@ import (
99
"cmd/internal/obj"
1010
"cmd/internal/objabi"
1111
"cmd/internal/src"
12-
"os"
13-
"strconv"
1412
)
1513

1614
// A Config holds readonly compilation information.
1715
// It is created once, early during compilation,
1816
// and shared across all compilations.
1917
type Config struct {
20-
arch string // "amd64", etc.
21-
PtrSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.PtrSize
22-
RegSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.RegSize
23-
Types Types
24-
lowerBlock blockRewriter // lowering function
25-
lowerValue valueRewriter // lowering function
26-
registers []Register // machine registers
27-
gpRegMask regMask // general purpose integer register mask
28-
fpRegMask regMask // floating point register mask
29-
specialRegMask regMask // special register mask
30-
GCRegMap []*Register // garbage collector register map, by GC register index
31-
FPReg int8 // register number of frame pointer, -1 if not used
32-
LinkReg int8 // register number of link register if it is a general purpose register, -1 if not used
33-
hasGReg bool // has hardware g register
34-
ctxt *obj.Link // Generic arch information
35-
optimize bool // Do optimization
36-
noDuffDevice bool // Don't use Duff's device
37-
useSSE bool // Use SSE for non-float operations
38-
useAvg bool // Use optimizations that need Avg* operations
39-
useHmul bool // Use optimizations that need Hmul* operations
40-
nacl bool // GOOS=nacl
41-
use387 bool // GO386=387
42-
SoftFloat bool //
43-
NeedsFpScratch bool // No direct move between GP and FP register sets
44-
BigEndian bool //
45-
sparsePhiCutoff uint64 // Sparse phi location algorithm used above this #blocks*#variables score
18+
arch string // "amd64", etc.
19+
PtrSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.PtrSize
20+
RegSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.RegSize
21+
Types Types
22+
lowerBlock blockRewriter // lowering function
23+
lowerValue valueRewriter // lowering function
24+
registers []Register // machine registers
25+
gpRegMask regMask // general purpose integer register mask
26+
fpRegMask regMask // floating point register mask
27+
specialRegMask regMask // special register mask
28+
GCRegMap []*Register // garbage collector register map, by GC register index
29+
FPReg int8 // register number of frame pointer, -1 if not used
30+
LinkReg int8 // register number of link register if it is a general purpose register, -1 if not used
31+
hasGReg bool // has hardware g register
32+
ctxt *obj.Link // Generic arch information
33+
optimize bool // Do optimization
34+
noDuffDevice bool // Don't use Duff's device
35+
useSSE bool // Use SSE for non-float operations
36+
useAvg bool // Use optimizations that need Avg* operations
37+
useHmul bool // Use optimizations that need Hmul* operations
38+
nacl bool // GOOS=nacl
39+
use387 bool // GO386=387
40+
SoftFloat bool //
41+
NeedsFpScratch bool // No direct move between GP and FP register sets
42+
BigEndian bool //
4643
}
4744

4845
type (
@@ -360,22 +357,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config
360357
opcodeTable[Op386LoweredWB].reg.clobbers |= 1 << 3 // BX
361358
}
362359

363-
// cutoff is compared with product of numblocks and numvalues,
364-
// if product is smaller than cutoff, use old non-sparse method.
365-
// cutoff == 0 implies all sparse.
366-
// cutoff == -1 implies none sparse.
367-
// Good cutoff values seem to be O(million) depending on constant factor cost of sparse.
368-
// TODO: get this from a flag, not an environment variable
369-
c.sparsePhiCutoff = 2500000 // 0 for testing. // 2500000 determined with crude experiments w/ make.bash
370-
ev := os.Getenv("GO_SSA_PHI_LOC_CUTOFF")
371-
if ev != "" {
372-
v, err := strconv.ParseInt(ev, 10, 64)
373-
if err != nil {
374-
ctxt.Diag("Environment variable GO_SSA_PHI_LOC_CUTOFF (value '%s') did not parse as a number", ev)
375-
}
376-
c.sparsePhiCutoff = uint64(v) // convert -1 to maxint, for never use sparse
377-
}
378-
379360
// Create the GC register map index.
380361
// TODO: This is only used for debug printing. Maybe export config.registers?
381362
gcRegMapSize := int16(0)
@@ -399,5 +380,4 @@ func (c *Config) Set387(b bool) {
399380
c.use387 = b
400381
}
401382

402-
func (c *Config) SparsePhiCutoff() uint64 { return c.sparsePhiCutoff }
403-
func (c *Config) Ctxt() *obj.Link { return c.ctxt }
383+
func (c *Config) Ctxt() *obj.Link { return c.ctxt }

0 commit comments

Comments
 (0)