Skip to content

Commit

Permalink
Fix a crash in llvm if the sreg of a setret is not set because the me…
Browse files Browse the repository at this point in the history
…thods ends with a throw.
  • Loading branch information
vargaz committed Mar 4, 2021
1 parent 9c628c3 commit 6038934
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mono/mono/mini/mini-llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5227,7 +5227,8 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
/* The return type is an LLVM aggregate type, so a bare bitcast cannot be used to do this conversion. */
int width = mono_type_size (sig->ret, NULL);
int elems = width / TARGET_SIZEOF_VOID_P;
LLVMValueRef val = LLVMBuildBitCast (builder, values [ins->sreg1], LLVMVectorType (IntPtrType (), elems), "");
/* The return value might not be set if there is a throw */
LLVMValueRef val = lhs ? LLVMBuildBitCast (builder, lhs, LLVMVectorType (IntPtrType (), elems), "") : LLVMConstNull (LLVMVectorType (IntPtrType (), elems));
for (int i = 0; i < elems; ++i) {
LLVMValueRef element = LLVMBuildExtractElement (builder, val, const_int32 (i), "");
retval = LLVMBuildInsertValue (builder, retval, element, i, "setret_simd_vtype_in_reg");
Expand Down

0 comments on commit 6038934

Please sign in to comment.