@@ -3492,6 +3492,12 @@ static Value *emit_bits_compare(jl_codectx_t &ctx, jl_cgval_t arg1, jl_cgval_t a
34923492 varg1 = emit_bitcast (ctx, varg1, TpInt8);
34933493 varg2 = emit_bitcast (ctx, varg2, TpInt8);
34943494
3495+ // See above for why we want to do this
3496+ SmallVector<Value*, 0 > gc_uses;
3497+ gc_uses.append (get_gc_roots_for (ctx, arg1));
3498+ gc_uses.append (get_gc_roots_for (ctx, arg2));
3499+ OperandBundleDef OpBundle (" jl_roots" , gc_uses);
3500+
34953501 Value *answer = nullptr ;
34963502 auto emit_desc = [&](egal_desc desc) {
34973503 Value *ptr1 = varg1;
@@ -3540,7 +3546,8 @@ static Value *emit_bits_compare(jl_codectx_t &ctx, jl_cgval_t arg1, jl_cgval_t a
35403546 Value *this_answer = ctx.builder .CreateCall (prepare_call (memcmp_func),
35413547 { ptr1,
35423548 ptr2,
3543- ConstantInt::get (ctx.types ().T_size , desc.data_bytes ) });
3549+ ConstantInt::get (ctx.types ().T_size , desc.data_bytes ) },
3550+ ArrayRef<OperandBundleDef>(&OpBundle, gc_uses.empty () ? 0 : 1 ));
35443551 this_answer = ctx.builder .CreateICmpEQ (this_answer, ConstantInt::get (getInt32Ty (ctx.builder .getContext ()), 0 ));
35453552 answer = answer ? ctx.builder .CreateAnd (answer, this_answer) : this_answer;
35463553 if (endptr1) {
0 commit comments