mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.simd] cmd/compile: minor tweak for race detector
This makes the front-end a little bit less temp-happy when instrumenting, which repairs the "is it a constant?" test in the simd intrinsic conversion which is otherwise broken by race detection. Also, this will perhaps be better code. Change-Id: I84b7a45b7bff62bb2c9f9662466b50858d288645 Reviewed-on: https://go-review.googlesource.com/c/go/+/685637 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
43a61aef56
commit
2bb45cb8a5
1 changed files with 9 additions and 0 deletions
|
|
@ -311,6 +311,15 @@ func backingArrayPtrLen(n ir.Node) (ptr, length ir.Node) {
|
|||
// function calls, which could clobber function call arguments/results
|
||||
// currently on the stack.
|
||||
func mayCall(n ir.Node) bool {
|
||||
// This is intended to avoid putting constants
|
||||
// into temporaries with the race detector (or other
|
||||
// instrumentation) which interferes with simple
|
||||
// "this is a constant" tests in ssagen.
|
||||
// Also, it will generally lead to better code.
|
||||
if n.Op() == ir.OLITERAL {
|
||||
return false
|
||||
}
|
||||
|
||||
// When instrumenting, any expression might require function calls.
|
||||
if base.Flag.Cfg.Instrumenting {
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue