@@ -2372,7 +2372,11 @@ void LateLowerGCFrame::PlaceGCFrameStore(State &S, unsigned R, unsigned MinColor
23722372 // free to rewrite them if convenient. We need to change
23732373 // it back here for the store.
23742374 assert (Val->getType () == T_prjlvalue);
2375+ #if JL_LLVM_VERSION >= 200000
23752376 new StoreInst (Val, slotAddress, InsertBefore->getIterator ());
2377+ #else
2378+ new StoreInst (Val, slotAddress, InsertBefore);
2379+ #endif
23762380}
23772381
23782382void LateLowerGCFrame::PlaceGCFrameReset (State &S, unsigned R, unsigned MinColorRoot,
@@ -2382,10 +2386,18 @@ void LateLowerGCFrame::PlaceGCFrameReset(State &S, unsigned R, unsigned MinColor
23822386 auto slotAddress = CallInst::Create (
23832387 getOrDeclare (jl_intrinsics::getGCFrameSlot),
23842388 {GCFrame, ConstantInt::get (Type::getInt32Ty (InsertBefore->getContext ()), Colors[R] + MinColorRoot)},
2389+ #if JL_LLVM_VERSION >= 200000
2390+ " gc_slot_addr_" + StringRef (std::to_string (Colors[R] + MinColorRoot)), InsertBefore->getIterator ());
2391+ #else
23852392 " gc_slot_addr_" + StringRef (std::to_string (Colors[R] + MinColorRoot)), InsertBefore);
2393+ #endif
23862394 // Reset the slot to NULL.
23872395 Value *Val = ConstantPointerNull::get (T_prjlvalue);
2396+ #if JL_LLVM_VERSION >= 200000
2397+ new StoreInst (Val, slotAddress, InsertBefore->getIterator ());
2398+ #else
23882399 new StoreInst (Val, slotAddress, InsertBefore);
2400+ #endif
23892401}
23902402
23912403void LateLowerGCFrame::PlaceGCFrameStores (State &S, unsigned MinColorRoot,
@@ -2406,7 +2418,7 @@ void LateLowerGCFrame::PlaceGCFrameStores(State &S, unsigned MinColorRoot,
24062418 for (int Idx : *LastLive) {
24072419 if (Colors[Idx] >= PreAssignedColors && !HasBitSet (NowLive, Idx)) {
24082420 PlaceGCFrameReset (S, Idx, MinColorRoot, Colors, GCFrame,
2409- S.ReverseSafepointNumbering [*rit]);
2421+ S.ReverseSafepointNumbering [*rit]);
24102422 }
24112423 }
24122424 // store values which are alive in this safepoint but
@@ -2438,7 +2450,7 @@ void LateLowerGCFrame::PlaceRootsAndUpdateCalls(ArrayRef<int> Colors, int PreAss
24382450 getOrDeclare (jl_intrinsics::newGCFrame),
24392451 {ConstantInt::get (T_int32, 0 )},
24402452 " gcframe" );
2441- gcframe->insertBefore (&* F->getEntryBlock ().begin ());
2453+ gcframe->insertBefore (F->getEntryBlock ().begin ());
24422454
24432455 auto pushGcframe = CallInst::Create (
24442456 getOrDeclare (jl_intrinsics::pushGCFrame),
@@ -2536,7 +2548,11 @@ void LateLowerGCFrame::PlaceRootsAndUpdateCalls(ArrayRef<int> Colors, int PreAss
25362548 assert (Elem->getType () == T_prjlvalue);
25372549 // auto Idxs = ArrayRef<unsigned>(Tracked[i]);
25382550 // Value *Elem = ExtractScalar(Base, true, Idxs, SI);
2551+ #if JL_LLVM_VERSION >= 200000
25392552 Value *shadowStore = new StoreInst (Elem, slotAddress, SI->getIterator ());
2553+ #else
2554+ Value *shadowStore = new StoreInst (Elem, slotAddress, SI);
2555+ #endif
25402556 (void )shadowStore;
25412557 // TODO: shadowStore->setMetadata(LLVMContext::MD_tbaa, tbaa_gcframe);
25422558 AllocaSlot++;
@@ -2554,7 +2570,11 @@ void LateLowerGCFrame::PlaceRootsAndUpdateCalls(ArrayRef<int> Colors, int PreAss
25542570 auto popGcframe = CallInst::Create (
25552571 getOrDeclare (jl_intrinsics::popGCFrame),
25562572 {gcframe});
2573+ #if JL_LLVM_VERSION >= 200000
2574+ popGcframe->insertBefore (BB.getTerminator ()->getIterator ());
2575+ #else
25572576 popGcframe->insertBefore (BB.getTerminator ());
2577+ #endif
25582578 }
25592579 }
25602580 }
0 commit comments