From: Russ Cox Date: Tue, 17 Nov 2009 01:40:47 +0000 (-0800) Subject: gc: change "can we const evaluate this" from blacklist to whitelist X-Git-Tag: weekly.2009-11-17~30 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1ee83f851dd7b70564c54f60575957ed84a368b7;p=gostls13.git gc: change "can we const evaluate this" from blacklist to whitelist R=ken2 https://golang.org/cl/155074 --- diff --git a/src/cmd/gc/const.c b/src/cmd/gc/const.c index b11ab1c7f8..cca13b9528 100644 --- a/src/cmd/gc/const.c +++ b/src/cmd/gc/const.c @@ -329,14 +329,38 @@ evconst(Node *n) Val v; Mpint b; + // pick off just the opcodes that can be + // constant evaluated. switch(n->op) { - case OMAKE: - case OMAKEMAP: - case OMAKESLICE: - case OMAKECHAN: - case ODCLCONST: - case OCONVIFACE: + default: return; + case OADD: + case OADDSTR: + case OAND: + case OANDAND: + case OANDNOT: + case OARRAYBYTESTR: + case OCOM: + case OCONV: + case ODIV: + case OEQ: + case OGE: + case OGT: + case OLE: + case OLSH: + case OLT: + case OMINUS: + case OMOD: + case OMUL: + case ONE: + case ONOT: + case OOR: + case OOROR: + case OPLUS: + case ORSH: + case OSUB: + case OXOR: + break; } nl = n->left;