]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: avoid excessive libfuzzer instrumentation of int compares
authorKhaled Yakdan <yakdan@code-intelligence.com>
Mon, 11 Jul 2022 15:56:37 +0000 (15:56 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 31 Aug 2022 07:49:01 +0000 (07:49 +0000)
Do not intercept integer compares that are used to increment libFuzzer's
8-bit counters. This is unnecessary and has a negative impact on the
fuzzing performance. This fixes #53760.

Change-Id: Id22efac968b18014eedabb6f0762e1456897024e
GitHub-Last-Rev: 52f69fd68c21001beb7b853d4f0343ece0d3f9d1
GitHub-Pull-Request: golang/go#53786
Reviewed-on: https://go-review.googlesource.com/c/go/+/416796
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/walk/compare.go

index df7cb731f7b9b35be7dcdde01514055c65c56018..8a8f9b6d93beb389c104623282a6b84256ff9fe7 100644 (file)
@@ -116,7 +116,7 @@ func walkCompare(n *ir.BinaryExpr, init *ir.Nodes) ir.Node {
 
        switch t.Kind() {
        default:
-               if base.Debug.Libfuzzer != 0 && t.IsInteger() {
+               if base.Debug.Libfuzzer != 0 && t.IsInteger() && (n.X.Name() == nil || !n.X.Name().Libfuzzer8BitCounter()) {
                        n.X = cheapExpr(n.X, init)
                        n.Y = cheapExpr(n.Y, init)