Merge pull request #3370 from rtfeldman/list-unreachable

List unreachable
This commit is contained in:
Richard Feldman 2022-07-06 10:45:50 -04:00 committed by GitHub
commit 7365da6f69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 10 deletions

View file

@ -6090,6 +6090,20 @@ fn run_low_level<'a, 'ctx, 'env>(
PtrCast | RefCountInc | RefCountDec => {
unreachable!("Not used in LLVM backend: {:?}", op);
}
Unreachable => match RocReturn::from_layout(env, layout) {
RocReturn::Return => {
let basic_type = basic_type_from_layout(env, layout);
basic_type.const_zero()
}
RocReturn::ByPointer => {
let basic_type = basic_type_from_layout(env, layout);
let ptr = env.builder.build_alloca(basic_type, "unreachable_alloca");
env.builder.build_store(ptr, basic_type.const_zero());
ptr.into()
}
},
}
}