https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101064
Bug ID: 101064 Summary: long compile time in var_tracking for Go package Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: thanm at google dot com Target Milestone: --- Created attachment 51008 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51008&action=edit testcase to reproduce (Go files, some profile reports) Building the attached Go package with gccgo results in a very long compile time, apparently due to var_tracking. To reproduce, unpack the tar file and build with either: A) go clean -cache; go build . or B) gccgo -c -O2 -g -m64 -fgo-pkgpath=xyz ./aenum.go ./avx_optabs.go [Note: this issue is first posted on the main Go issue tracker at https://github.com/golang/go/issues/46600; more details there]. This is a fairly modest sized Go package; building it with the main (non-gcc) Go compiler takes about a third of a second (user + sys, reported by /bin/time). For gccgo, building with -O0 takes about a second, but the time taken at -O1 and -O2 are much longer: -O1: 450 seconds -O2: 257 seconds Along with the test case, I am attaching some profiles collected using 'pprof'. The pass consuming the extra compile time appears to be variable_tracking; from the profiles the problem looks to be related to alias analysis / memory disambiguation.