@@ -1122,14 +1122,17 @@ static std::pair<Value*, bool> emit_isa(jl_codectx_t &ctx, const jl_cgval_t &x,
1122
1122
jl_value_t *type, const std::string *msg);
1123
1123
1124
1124
static void emit_isa_union (jl_codectx_t &ctx, const jl_cgval_t &x, jl_value_t *type,
1125
- SmallVectorImpl<std::pair<BasicBlock*,Value*>> &bbs)
1125
+ SmallVectorImpl<std::pair<std::pair< BasicBlock*,BasicBlock*> ,Value*>> &bbs)
1126
1126
{
1127
1127
if (jl_is_uniontype (type)) {
1128
1128
emit_isa_union (ctx, x, ((jl_uniontype_t *)type)->a , bbs);
1129
1129
emit_isa_union (ctx, x, ((jl_uniontype_t *)type)->b , bbs);
1130
1130
return ;
1131
1131
}
1132
- bbs.emplace_back (ctx.builder .GetInsertBlock (), emit_isa (ctx, x, type, nullptr ).first );
1132
+ BasicBlock *enter = ctx.builder .GetInsertBlock ();
1133
+ Value *v = emit_isa (ctx, x, type, nullptr ).first ;
1134
+ BasicBlock *exit = ctx.builder .GetInsertBlock ();
1135
+ bbs.emplace_back (std::make_pair (enter, exit), v);
1133
1136
BasicBlock *isaBB = BasicBlock::Create (jl_LLVMContext, " isa" , ctx.f );
1134
1137
ctx.builder .SetInsertPoint (isaBB);
1135
1138
}
@@ -1231,16 +1234,16 @@ static std::pair<Value*, bool> emit_isa(jl_codectx_t &ctx, const jl_cgval_t &x,
1231
1234
}
1232
1235
if (jl_is_uniontype (intersected_type) &&
1233
1236
can_optimize_isa_union ((jl_uniontype_t *)intersected_type)) {
1234
- SmallVector<std::pair<BasicBlock*,Value*>,4 > bbs;
1237
+ SmallVector<std::pair<std::pair< BasicBlock*,BasicBlock*> ,Value*>,4 > bbs;
1235
1238
emit_isa_union (ctx, x, intersected_type, bbs);
1236
1239
int nbbs = bbs.size ();
1237
1240
BasicBlock *currBB = ctx.builder .GetInsertBlock ();
1238
1241
PHINode *res = ctx.builder .CreatePHI (T_int1, nbbs);
1239
1242
for (int i = 0 ; i < nbbs; i++) {
1240
- auto bb = bbs[i].first ;
1243
+ auto bb = bbs[i].first . second ;
1241
1244
ctx.builder .SetInsertPoint (bb);
1242
1245
if (i + 1 < nbbs) {
1243
- ctx.builder .CreateCondBr (bbs[i].second , currBB, bbs[i + 1 ].first );
1246
+ ctx.builder .CreateCondBr (bbs[i].second , currBB, bbs[i + 1 ].first . first );
1244
1247
res->addIncoming (ConstantInt::get (T_int1, 1 ), bb);
1245
1248
}
1246
1249
else {
0 commit comments