Skip to content

Commit 0fe775e

Browse files
committed
cmd/compile: drop TODO in NilCheck for riscv64
Also add log as arm/amd64 do. Change-Id: I3698993e2df0ebf3bfcf8bad5fe389affa0e8eff Reviewed-on: https://go-review.googlesource.com/c/go/+/595355 Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent f95ae3d commit 0fe775e

File tree

1 file changed

+4
-1
lines changed
  • src/cmd/compile/internal/riscv64

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package riscv64
77
import (
88
"cmd/compile/internal/base"
99
"cmd/compile/internal/ir"
10+
"cmd/compile/internal/logopt"
1011
"cmd/compile/internal/objw"
1112
"cmd/compile/internal/ssa"
1213
"cmd/compile/internal/ssagen"
@@ -720,13 +721,15 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
720721

721722
case ssa.OpRISCV64LoweredNilCheck:
722723
// Issue a load which will fault if arg is nil.
723-
// TODO: optimizations. See arm and amd64 LoweredNilCheck.
724724
p := s.Prog(riscv.AMOVB)
725725
p.From.Type = obj.TYPE_MEM
726726
p.From.Reg = v.Args[0].Reg()
727727
ssagen.AddAux(&p.From, v)
728728
p.To.Type = obj.TYPE_REG
729729
p.To.Reg = riscv.REG_ZERO
730+
if logopt.Enabled() {
731+
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
732+
}
730733
if base.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos == 1 in generated wrappers
731734
base.WarnfAt(v.Pos, "generated nil check")
732735
}

0 commit comments

Comments
 (0)