Fix usage of vregs defined in EH regions in the LLVM backend. Fixes #7183.
authorZoltan Varga <vargaz@gmail.com>
Mon, 17 Sep 2012 16:53:19 +0000 (18:53 +0200)
committerZoltan Varga <vargaz@gmail.com>
Mon, 17 Sep 2012 16:53:19 +0000 (18:53 +0200)
mono/mini/mini-llvm.c

index d6355faf5f3bca20d1dc3af51e6a59c37c3d4edb..24634533bf119728f4f27ad2a9f994a2a1e6d2af 100644 (file)
@@ -3041,7 +3041,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                }
 
                case OP_CHECK_THIS:
                }
 
                case OP_CHECK_THIS:
-                       emit_load (ctx, bb, &builder, sizeof (gpointer), convert (ctx, values [ins->sreg1], LLVMPointerType (IntPtrType (), 0)), "", TRUE);
+                       emit_load (ctx, bb, &builder, sizeof (gpointer), convert (ctx, lhs, LLVMPointerType (IntPtrType (), 0)), "", TRUE);
                        break;
                case OP_OUTARG_VTRETADDR:
                        break;
                        break;
                case OP_OUTARG_VTRETADDR:
                        break;
@@ -4461,7 +4461,9 @@ mono_llvm_emit_method (MonoCompile *cfg)
                        if (ctx->unreachable [node->in_bb->block_num])
                                continue;
 
                        if (ctx->unreachable [node->in_bb->block_num])
                                continue;
 
-                       g_assert (values [sreg1]);
+                       if (!values [sreg1])
+                               /* Can happen with values in EH clauses */
+                               LLVM_FAILURE (ctx, "incoming phi sreg1");
 
                        if (phi->opcode == OP_VPHI) {
                                g_assert (LLVMTypeOf (ctx->addresses [sreg1]) == LLVMTypeOf (values [phi->dreg]));
 
                        if (phi->opcode == OP_VPHI) {
                                g_assert (LLVMTypeOf (ctx->addresses [sreg1]) == LLVMTypeOf (values [phi->dreg]));