diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2015-08-04 14:22:29 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2015-08-04 22:48:34 +0000 |
commit | 573c791e81f4356698e604bb2fdba13518edc736 (patch) | |
tree | 30b030cd4798d5d57257672aa76d33edc3fe5768 /src/cmd/compile/internal/ssa/regalloc_test.go | |
parent | 54dca047dd646cfd071fe24cafb57c91a6262992 (diff) | |
download | go-573c791e81f4356698e604bb2fdba13518edc736.tar.gz go-573c791e81f4356698e604bb2fdba13518edc736.zip |
[dev.ssa] cmd/compile: treat control ops as live at end of block
Failure to treat control ops as live can lead
to them being eliminated when they live in
other blocks.
Change-Id: I604a1977a3d3884b1f4516bea4e15885ce38272d
Reviewed-on: https://go-review.googlesource.com/13138
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/regalloc_test.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/regalloc_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/regalloc_test.go b/src/cmd/compile/internal/ssa/regalloc_test.go new file mode 100644 index 0000000000..dcd253ea14 --- /dev/null +++ b/src/cmd/compile/internal/ssa/regalloc_test.go @@ -0,0 +1,32 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ssa + +import "testing" + +func TestLiveControlOps(t *testing.T) { + c := testConfig(t) + f := Fun(c, "entry", + Bloc("entry", + Valu("mem", OpArg, TypeMem, 0, ".mem"), + Valu("x", OpAMD64MOVBconst, TypeInt8, 0, 1), + Valu("y", OpAMD64MOVBconst, TypeInt8, 0, 2), + Valu("a", OpAMD64TESTB, TypeBool, 0, nil, "x", "y"), + Valu("b", OpAMD64TESTB, TypeBool, 0, nil, "y", "x"), + If("a", "if", "exit"), + ), + Bloc("if", + If("b", "plain", "exit"), + ), + Bloc("plain", + Goto("exit"), + ), + Bloc("exit", + Exit("mem"), + ), + ) + regalloc(f.f) + checkFunc(f.f) +} |