title: What's Go cmd option 'gcflags' all possible values
body: <p>I'm learning about Go memory optimization through inlining. The following code is my test code.</p>
  <p>I use <code>go build -gcflags=-m=2 main.go</code> to get all the results. I follow <a href="https://dave.cheney.net/2020/05/02/mid-stack-inlining-in-go" rel="noreferrer">Dave Cheney's post</a> to do this.</p>
  <p>My question is: What're the values of 'gcflags'? Where is the documentation, I couldn't find the doc by Google?</p>
  <pre><code>func fn1() int {
      s := 1+2
      return s
  }
  
  func fn2() string {
      a := &quot;h&quot;
      a += &quot;e&quot;
      a += &quot;l&quot;
      a += &quot;l&quot;
      a += &quot;o&quot;
      b := &quot; &quot;
      c := &quot;w&quot;
      c += &quot;o&quot;
      c += &quot;r&quot;
      c += &quot;l&quot;
      c += &quot;d&quot;
      d := &quot;d&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      d += &quot;e&quot;
      s := a + b + c
      return s
  }
  
  func fn3() {
      p := fn1()
  
      s := fn2()
  
      println(&quot;p = &quot; + string(p))
      println(&quot;s = &quot; + s)
  }
  </code></pre>
  <p>output:</p>
  <pre><code>go build -gcflags='-m=2' main.go
  # command-line-arguments
  ./main.go:3:6: can inline fn1 as: func() int { s := 1 + 2; return s }
  ./main.go:16:6: cannot inline fn2: function too complex: cost 81 exceeds budget 80
  ./main.go:47:6: cannot inline fn3: function too complex: cost 85 exceeds budget 80
  </code></pre>
  <p><strong>I also tried <code>-gcflags=-m=3, -gcflags=-m=4, -gcflags=-m=5</code>, the results is like below, very hard to understand. Maybe somebody can help me point out a direction.</strong></p>
  <pre><code>go build -gcflags=-m=3 main.go
  # command-line-arguments
  ./main.go:3:6: can inline fn1 as: func() int { s := 1 + 2; return s }
  ./main.go:8:6: cannot inline fn2: recursive
  ./main.go:16:6: can inline fn3 as: func() { p := fn1(); p = fn2(p); println(&quot;p = &quot; + string(p)) }
  ./main.go:17:10: inlining call to fn1 func() int { s := 1 + 2; return s }
  ./main.go:17:10: Before inlining:
  .   CALLFUNC l(17) tc(1) int
  .   .   NAME-inlining.fn1 l(3) x(0) class(PFUNC) tc(1) used FUNC-@0
  substituting name
  .   NAME-inlining.s g(2) l(4) x(0) class(PAUTO) tc(1) used int  -&gt;
  .   NAME-inlining.s l(4) x(0) class(PAUTO) tc(1) used int
  substituting name
  .   NAME-inlining.s g(2) l(4) x(0) class(PAUTO) tc(1) used int  -&gt;
  .   NAME-inlining.s l(4) x(0) class(PAUTO) tc(1) used int
  substituting name
  .   NAME-inlining.s g(2) l(4) x(0) class(PAUTO) tc(1) used int  -&gt;
  .   NAME-inlining.s l(4) x(0) class(PAUTO) tc(1) used int
  ./main.go:17:10: After inlining
  .   INLCALL-init
  .   .   DCL l(17)
  .   .   .   NAME-inlining.~r0 l(3) x(0) class(PAUTO) tc(1) assigned used int
  
  .   .   AS l(17) tc(1)
  .   .   .   NAME-inlining.~r0 l(3) x(0) class(PAUTO) tc(1) assigned used int
  
  .   .   INLMARK l(+17) x(0)
  .   INLCALL l(17) tc(1) int
  .   INLCALL-rlist
  .   .   NAME-inlining.~r0 l(3) x(0) class(PAUTO) tc(1) assigned used int
  ..... // too much
  </code></pre>