Commit Graph

3 Commits

Author SHA1 Message Date
Peter Collingbourne 1f89ffdf4d irgen: fix canAvoid*
Patch by Andrew Wilkins!

canAvoidElementLoad and canAvoidLoad were incorrectly
eliding loads when an index expression is used as an
another array index expression. This led to a panic.

See comments on https://github.com/go-llvm/llgo/issues/175

Test Plan: lit test added

Differential Revision: http://reviews.llvm.org/D6676

llvm-svn: 224420
2014-12-17 09:45:05 +00:00
Peter Collingbourne 545e7276a8 Use the object's package to mangle method names, rather than the receiver's package
If we use the receiver's package, we can end up with identical manglings
for different functions. Consider:

package p
type U struct{}
func (U) f()

package q
import "p"
type T struct { p.U }
func (T) f()

The method set of *T has two synthetic methods named (*T).f(); one forwards to
(T).f(), and the other to (U).f(). Previously, we were distinguishing them
by the receiver's package, and in this case because both methods have the
same receiver, they received the same name.

The methods are correctly distinguished by the package owning the identifier
"f", which is available via f.Object().Pkg().

Differential Revision: http://reviews.llvm.org/D6673

llvm-svn: 224357
2014-12-16 20:04:55 +00:00
Peter Collingbourne ad9841e8ac Initial commit of llgo.
llvm-svn: 222857
2014-11-27 00:06:42 +00:00