New Issue: Feature request: Improve copy elision / dead variable analysis to support tuple expressions

18077, "bradcray", "Feature request: Improve copy elision / dead variable analysis to support tuple expressions", "2021-07-17T00:37:40Z"

This issue asks: what would it take to improve our copy elision / dead variable analysis to support de-tupling of dead non-nilable owned classes for cases like the following:

class C {
  var x: int;
}

proc foo(): (owned C, owned C) {
  return (new owned C(45), new owned C(33));
}

var (x, y) = foo();
writeln((x,y));
class C {
  var x: int;
}

var (x, y) = (new owned C(45), new owned C(33));;
writeln((x,y));

where today, such cases result in errors like:

error: Cannot transfer ownership from this non-nilable reference variable

Configuration Information

  • Output of chpl --version: chpl version 1.25.0 pre-release (509b0f6b49)