The functions below are OK:
fn foo1(x: Option<Box<int>>) -> Option<int> {
let res = match x {
Some(ref v) => v.clone(),
None => return None
};
Some(*res)
}
fn foo2(x: Option<Box<int>>) -> Option<int> {
let res = match x {
Some(ref v) => Some(*v.clone()),
None => return None
};
return res;
}
but:
fn foo3(x: Option<Box<int>>) -> Option<int> {
let res = match x {
Some(ref v) => *v.clone(),
None => return None
};
Some(res)
}
produces a LLVM ERROR. The message is:
Instruction does not dominate all uses!
%8 = load i64** %2
%12 = bitcast i64* %8 to i8*
LLVM ERROR: Broken function found, compilation aborted!
I'm sorry if it isn't a minimum example of this issue.