[PATCH] [llgo] Elide alloca for unused received values in select

Peter Collingbourne peter at pcc.me.uk
Sun Dec 28 07:03:46 PST 2014


================
Comment at: irgen/channels.go:64
@@ -62,3 +63,3 @@
 
 // selectState is equivalent to ssa.SelectState
 type selectState struct {
----------------
It looks like we don't need this struct definition any more.

================
Comment at: irgen/channels.go:71
@@ -69,4 +70,3 @@
 
-func (fr *frame) chanSelect(states []selectState, blocking bool) (index, recvOk *govalue, recvElems []*govalue) {
-	n := uint64(len(states))
-	if !blocking {
+func chanSelect(fr *frame, sel *ssa.Select) (index, recvOk *govalue, recvElems []*govalue) {
+	n := uint64(len(sel.States))
----------------
Was there any particular reason to make this a top-level function rather than a method?

================
Comment at: irgen/channels.go:136
@@ +135,3 @@
+		}
+		return len(*extract.Referrers()) > 0
+	}
----------------
There could in principle be multiple `extract` referrers. With this code you end up checking only the first one.

http://reviews.llvm.org/D6785

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list