From ce9778891400e0c6b9ad245e1e9b4bca2a08a3c9 Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Tue, 11 Aug 2015 19:31:53 -0500 Subject: [PATCH] [dev.ssa] cmd/compile/ssa: fix test for dse Fix the test broken with dee1f2 by implementing Elem() Change-Id: I7a4a487885267c24fdc52d79fb7d450231328812 Reviewed-on: https://go-review.googlesource.com/13551 Reviewed-by: Keith Randall --- src/cmd/compile/internal/ssa/deadstore_test.go | 3 ++- src/cmd/compile/internal/ssa/type_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/ssa/deadstore_test.go b/src/cmd/compile/internal/ssa/deadstore_test.go index 8d9b4b1298..634192f25b 100644 --- a/src/cmd/compile/internal/ssa/deadstore_test.go +++ b/src/cmd/compile/internal/ssa/deadstore_test.go @@ -8,7 +8,8 @@ import "testing" func TestDeadStore(t *testing.T) { c := testConfig(t) - ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr"} // dummy for testing + elemType := &TypeImpl{Size_: 8, Name: "testtype"} + ptrType := &TypeImpl{Size_: 8, Ptr: true, Name: "testptr", Elem_: elemType} // dummy for testing fun := Fun(c, "entry", Bloc("entry", Valu("start", OpArg, TypeMem, 0, ".mem"), diff --git a/src/cmd/compile/internal/ssa/type_test.go b/src/cmd/compile/internal/ssa/type_test.go index 6f8dd6d937..29bd5cd131 100644 --- a/src/cmd/compile/internal/ssa/type_test.go +++ b/src/cmd/compile/internal/ssa/type_test.go @@ -14,6 +14,7 @@ type TypeImpl struct { Float bool Ptr bool string bool + Elem_ Type Name string } @@ -29,7 +30,7 @@ func (t *TypeImpl) IsString() bool { return t.string } func (t *TypeImpl) IsMemory() bool { return false } func (t *TypeImpl) IsFlags() bool { return false } func (t *TypeImpl) String() string { return t.Name } -func (t *TypeImpl) Elem() Type { panic("not implemented") } +func (t *TypeImpl) Elem() Type { return t.Elem_ } func (t *TypeImpl) PtrTo() Type { panic("not implemented") } func (t *TypeImpl) Equal(u Type) bool {