Skip to content

Clone Optimisation & Move Analysis #34

Description

@DavePearce

(see also WyC#798)

At the moment, the clone optimisation is limited in places. Example (from LengthOf_Valid_1):

public export method test() :
    int[] l = [1, 2, 3]
    assume len(l) == 3

Becomes:

function LengthOf_Valid_1$test() {
   var l = [1, 2, 3];
   Wy.assert(LengthOf_Valid_1$len$Q4list(Wy.copy(l)) === 3);
}

Clearly, l is dead at the invocation and, hence, does not need to be cloned. Another example (from Record_Valid_4):

function f(structA x) -> (structB y):
    return x

Becomes

function Record_Valid_4$f$Q7structA(x) {
   return Wy.copy(x);
}

Again, this clone is clearly unnecessary.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions