Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(333)

Side by Side Diff: src/cmd/gc/walk.c

Issue 13334052: code review 13334052: cmd/gc: eliminate redundant &x.Field nil checks (Closed)
Patch Set: diff -r 2e735aa41d4a https://code.google.com/p/go/ Created 11 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/gc/popt.c ('k') | test/nilptr3.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include <u.h> 5 #include <u.h>
6 #include <libc.h> 6 #include <libc.h>
7 #include "go.h" 7 #include "go.h"
8 8
9 static Node* walkprint(Node*, NodeList**, int); 9 static Node* walkprint(Node*, NodeList**, int);
10 static Node* mapfn(char*, Type*); 10 static Node* mapfn(char*, Type*);
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 case OPLUS: 400 case OPLUS:
401 case OCOM: 401 case OCOM:
402 case OREAL: 402 case OREAL:
403 case OIMAG: 403 case OIMAG:
404 case ODOTMETH: 404 case ODOTMETH:
405 case ODOTINTER: 405 case ODOTINTER:
406 walkexpr(&n->left, init); 406 walkexpr(&n->left, init);
407 goto ret; 407 goto ret;
408 408
409 case OIND: 409 case OIND:
410 if(n->left->type->type->width == 0) {
411 // No actual copy will be generated, so emit an explicit nil check.
412 n->left = cheapexpr(n->left, init);
413 checknil(n->left, init);
414 }
415 walkexpr(&n->left, init); 410 walkexpr(&n->left, init);
416 goto ret; 411 goto ret;
417 412
418 case ODOT: 413 case ODOT:
419 usefield(n); 414 usefield(n);
420 walkexpr(&n->left, init); 415 walkexpr(&n->left, init);
421 goto ret; 416 goto ret;
422 417
423 case ODOTPTR: 418 case ODOTPTR:
424 usefield(n); 419 usefield(n);
(...skipping 3314 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 !candiscardlist(n->ninit) || 3734 !candiscardlist(n->ninit) ||
3740 !candiscardlist(n->nbody) || 3735 !candiscardlist(n->nbody) ||
3741 !candiscardlist(n->nelse) || 3736 !candiscardlist(n->nelse) ||
3742 !candiscardlist(n->list) || 3737 !candiscardlist(n->list) ||
3743 !candiscardlist(n->rlist)) { 3738 !candiscardlist(n->rlist)) {
3744 return 0; 3739 return 0;
3745 } 3740 }
3746 ········ 3741 ········
3747 return 1; 3742 return 1;
3748 } 3743 }
OLDNEW
« no previous file with comments | « src/cmd/gc/popt.c ('k') | test/nilptr3.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b