compiler: discard global sink variables with static initializers

This is specifically for the test fixedbugs/issue23781.go, which
builds a large static array.  The code does compile and work without
this change, but it takes a long time and generates a large object
file.  Discarding the unnecessary static initializer makes this test
much faster.

Change-Id: Ic15b462bf049c0b19dce330e5925e6989775f369
Trust: Ian Lance Taylor <>
Reviewed-by: Than McIntosh <>
Reviewed-by: Cherry Zhang <>
3 files changed