1
0
mirror of https://github.com/golang/go synced 2024-10-01 22:28:33 -06:00

cmd/compile: fix no-opt build after moving decomposing user functions

decompose-builtin pass requires an opt pass, but -N disables
late-opt, the only opt pass (out of two) that happens
after decompose-builtin.  This CL enables both 'opt' and 'late opt'
passes. The extra compile time for 'late opt' in negligible
since most rewrites were already done in the first 'opt'
(also measured before). We should put some effort in splitting the
generic rules into required and optional.

Also update generic.rules comments about lowering
of StringMake and SliceMake.

Tested with GO_GCFLAGS=-N ./all.bash

Change-Id: I92999681aaa02587b6dc6e32ce997a91f1fc9499
Reviewed-on: https://go-review.googlesource.com/20682
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alexandru Moșoi 2016-03-14 19:11:19 +01:00 committed by Alexandru Moșoi
parent a4e31d42ee
commit 13f74db304
2 changed files with 7 additions and 1 deletions

View File

@ -183,7 +183,7 @@ var passes = [...]pass{
{name: "prove", fn: prove},
{name: "decompose builtin", fn: decomposeBuiltIn, required: true},
{name: "dec", fn: dec, required: true},
{name: "late opt", fn: opt}, // TODO: split required rules and optimizing rules
{name: "late opt", fn: opt, required: true}, // TODO: split required rules and optimizing rules
{name: "generic deadcode", fn: deadcode},
{name: "fuse", fn: fuse},
{name: "dse", fn: dse},

View File

@ -534,6 +534,9 @@
(Store [8] dst real mem))
// string ops
// Decomposing StringMake and lowering of StringPtr and StringLen
// happens in a later pass, dec, so that these operations are available
// to otherpasses for optimizations.
(StringPtr (StringMake (Const64 <t> [c]) _)) -> (Const64 <t> [c])
(StringLen (StringMake _ (Const64 <t> [c]))) -> (Const64 <t> [c])
(ConstString {s}) && config.PtrSize == 4 && s.(string) == "" ->
@ -563,6 +566,9 @@
(Store [config.PtrSize] dst ptr mem))
// slice ops
// Decomposing SliceMake, and lowering of SlicePtr, SliceLen, and SliceCap
// happens in a later pass, dec, so that these operations are available
// to other passes for optimizations.
(SlicePtr (SliceMake (Const64 <t> [c]) _ _)) -> (Const64 <t> [c])
(SliceLen (SliceMake _ (Const64 <t> [c]) _)) -> (Const64 <t> [c])
(SliceCap (SliceMake _ _ (Const64 <t> [c]))) -> (Const64 <t> [c])