Closed madmann91 closed 6 years ago
aobench fails to build (cpu backend):
impala: anydsl/thorin/src/thorin/be/llvm/llvm.cpp:1112: llvm::Type* thorin::CodeGen::convert(const Type*): Assertion `ret' failed.
I forgot to put a loop that iterates until fix point is reached for lower2cff. I have a commit that fixes this.
Did you push?
Stincilla looks fine with this. I'll send you information with some regressions on other codes.
@madmann91 Great work :+1: I'm fine with the changes
Apparently there are still some regressions on other code bases (fasis I believe?), so I need to look into that before merging.
I have added a new feature to this pull request. It is now possible to perform PE on mutable variables. The following Impala code:
fn @(?a & ?b) range(a: i32, b: i32, body: fn(i32) -> ()) -> () {
if a < b {
@@body(a);
range(a + 1, b, body, return)
}
}
fn @sort(p: &mut [i32], n: i32) -> () {
for i in range(1, n) {
let tmp = p(i);
fn @(?j) inner_loop(j: i32) -> () {
if j > 0 && tmp < p(j - 1) {
p(j) = p(j - 1);
inner_loop(j - 1);
} else {
p(j) = tmp;
}
}
inner_loop(i, continue)
}
}
extern fn main() -> [i32 * 10] {
let mut p = [1, 3, 4, 6, 7, 5, 8, 2, 9, 0];
sort(&mut p, 10);
[p(0), p(1), p(2), p(3), p(4), p(5), p(6), p(7), p(8), p(9)]
}
Now produces the following IR:
module 'test_mut'
main_15922(mem mem_15923, fn(mem, [10 x qs32]) return_15924) extern
return_15924(mem_15923, ([10 x qs32] definite_array qs32 0, qs32 1, qs32 2, qs32 3, qs32 4, qs32 5, qs32 6, qs32 7, qs32 8, qs32 9))
Great work :+1: