Commit 581331e7 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: fix race in SSA construction

syslook cannot be called safely during SSA construction.

Change-Id: Ief173babd2e964fd5016578073dd3ba12e5731c5
Reviewed-on: https://go-review.googlesource.com/107815
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 0a4b962c
......@@ -304,7 +304,9 @@ var (
racewriterange,
msanread,
msanwrite,
Udiv *obj.LSym
Udiv,
supportPopcnt,
supportSSE41 *obj.LSym
// GO386=387
ControlWord64trunc,
......
......@@ -81,6 +81,8 @@ func initssaconfig() {
msanread = sysfunc("msanread")
msanwrite = sysfunc("msanwrite")
Udiv = sysfunc("udiv")
supportPopcnt = sysfunc("support_popcnt")
supportSSE41 = sysfunc("support_sse41")
// GO386=387 runtime functions
ControlWord64trunc = sysfunc("controlWord64trunc")
......@@ -3019,8 +3021,7 @@ func init() {
makeRoundAMD64 := func(op ssa.Op) func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
return func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
aux := syslook("support_sse41").Sym.Linksym()
addr := s.entryNewValue1A(ssa.OpAddr, types.Types[TBOOL].PtrTo(), aux, s.sb)
addr := s.entryNewValue1A(ssa.OpAddr, types.Types[TBOOL].PtrTo(), supportSSE41, s.sb)
v := s.load(types.Types[TBOOL], addr)
b := s.endBlock()
b.Kind = ssa.BlockIf
......@@ -3183,8 +3184,7 @@ func init() {
sys.ARM64)
makeOnesCountAMD64 := func(op64 ssa.Op, op32 ssa.Op) func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
return func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
aux := syslook("support_popcnt").Sym.Linksym()
addr := s.entryNewValue1A(ssa.OpAddr, types.Types[TBOOL].PtrTo(), aux, s.sb)
addr := s.entryNewValue1A(ssa.OpAddr, types.Types[TBOOL].PtrTo(), supportPopcnt, s.sb)
v := s.load(types.Types[TBOOL], addr)
b := s.endBlock()
b.Kind = ssa.BlockIf
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment