go.tools/go/pointer: fix objectNode() bug causing it to return nil spuriously.

It was making the unsound assumption that cgn==nil => v is one
of {Global,Function,Const,Capture} to avoid checking v's type,
which is what it now does.  This caused more expensive
constraints to be generated, which is suboptimal though not
wrong exactly.

In one benchmark, this change reduces the number of complex
constraints by about 23% of loads and 53% of stores, and
increases the number of (simple) copy constraints by about 5%.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/106940043
diff --git a/go/pointer/gen.go b/go/pointer/gen.go
index 69eda20..9d8e2c1 100644
--- a/go/pointer/gen.go
+++ b/go/pointer/gen.go
@@ -808,7 +808,8 @@
 // down the SSA value graph, e.g IndexAddr(FieldAddr(Alloc))).
 //
 func (a *analysis) objectNode(cgn *cgnode, v ssa.Value) nodeid {
-	if cgn == nil {
+	switch v.(type) {
+	case *ssa.Global, *ssa.Function, *ssa.Const, *ssa.Capture:
 		// Global object.
 		obj, ok := a.globalobj[v]
 		if !ok {
@@ -822,11 +823,10 @@
 				obj = a.makeFunctionObject(v, nil)
 
 			case *ssa.Const:
-				// The only pointer-like Consts are nil.
+				// not addressable
 
 			case *ssa.Capture:
-				// For now, Captures have the same cardinality as globals.
-				// TODO(adonovan): treat captures context-sensitively.
+				// not addressable
 			}
 
 			if a.log != nil {
@@ -1178,9 +1178,11 @@
 		params += nodeid(a.sizeof(p.Type()))
 	}
 
-	// Free variables are treated like global variables:
+	// Free variables have global cardinality:
 	// the outer function sets them with MakeClosure;
 	// the inner function accesses them with Capture.
+	//
+	// TODO(adonovan): treat captures context-sensitively.
 
 	// Create value nodes for all value instructions
 	// since SSA may contain forward references.