artic
artic copied to clipboard
Storing intrinsics to local variables overwrites their names.
Simple way to reproduce this issue:
#[import(cc = "device", name = "llvm.exp.f32")] fn cpu_expf(_: f32) -> f32;
#[export]
fn foo (n : f32) -> f32 {
let bar = cpu_expf;
cpu_expf(n)
}
Defining bar overwrites the name of cpu_expf, which results in broken code being produced in thorin.
We should probably not rely on the names of continuations as much as we currently do.
The name is only here for debugging purposes, so I think it is fine to add a check that it is not already set before setting it.