Skip to content

Commit

Permalink
Inline class methods (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer authored Feb 27, 2025
1 parent 8ada887 commit 91f2b47
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aeneas/src/main/Version.v3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

// Updated by VCS scripts. DO NOT EDIT.
component Version {
def version: string = "III-9.1802";
def version: string = "III-9.1804";
var buildData: string;
}
1 change: 1 addition & 0 deletions aeneas/src/ssa/SsaInliner.v3
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ class SsaEarlyInliner(context: SsaContext, compilation: Compilation, gen: VstSsa
var inlinee: IrSpec;
match (apply.op.opcode) {
CallMethod(method) => inlinee = V3Op.extractIrSpec(apply.op, method);
CallClassMethod(method) => inlinee = V3Op.extractIrSpec(apply.op, method);
_ => continue;
}
if (!shouldInline(inlinee)) {
Expand Down
19 changes: 19 additions & 0 deletions test/enums/array_load_elim00.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@execute 0=36; 99=36
enum E {
A, B, C
}
def main(a: int) -> int {
var x = Array<int>.new(3);
x[0] = a;
x[E.A.tag] = 11;
x[1] = a;
x[E.B.tag] = 12;
x[2] = a;
x[E.C.tag] = 13;

var a = x[0];
var b = x[1];
var c = x[2];

return a + b + c;
}
23 changes: 23 additions & 0 deletions test/enums/array_load_elim01.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//@execute 0=36; 99=36
enum E {
A, B, C
}
def main(a: int) -> int {
var EA = E.A;
var EB = E.B;
var EC = E.C;

var x = Array<int>.new(3);
x[0] = a;
x[EA.tag] = 11;
x[1] = a;
x[EB.tag] = 12;
x[2] = a;
x[EC.tag] = 13;

var a = x[0];
var b = x[1];
var c = x[2];

return a + b + c;
}

0 comments on commit 91f2b47

Please sign in to comment.