@@ -396,8 +396,14 @@ CountTrackedPointers::CountTrackedPointers(Type *T) {
396
396
}
397
397
if (isa<ArrayType>(T))
398
398
count *= cast<ArrayType>(T)->getNumElements ();
399
- else if (isa<VectorType>(T))
399
+ else if (isa<VectorType>(T)) {
400
+ #if JL_LLVM_VERSION >= 120000
401
+ ElementCount EC = cast<VectorType>(T)->getElementCount ();
402
+ count *= EC.getKnownMinValue ();
403
+ #else
400
404
count *= cast<VectorType>(T)->getNumElements ();
405
+ #endif
406
+ }
401
407
}
402
408
if (count == 0 )
403
409
all = false ;
@@ -408,8 +414,14 @@ unsigned getCompositeNumElements(Type *T) {
408
414
return ST->getNumElements ();
409
415
else if (auto *AT = dyn_cast<ArrayType>(T))
410
416
return AT->getNumElements ();
411
- else
417
+ else {
418
+ #if JL_LLVM_VERSION >= 120000
419
+ ElementCount EC = cast<VectorType>(T)->getElementCount ();
420
+ return EC.getKnownMinValue ();
421
+ #else
412
422
return cast<VectorType>(T)->getNumElements ();
423
+ #endif
424
+ }
413
425
}
414
426
415
427
// Walk through a Type, and record the element path to every tracked value inside
@@ -625,8 +637,14 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
625
637
}
626
638
std::vector<int > Numbers;
627
639
unsigned NumRoots = 1 ;
628
- if (auto VTy = dyn_cast<VectorType>(SI->getType ()))
640
+ if (auto VTy = dyn_cast<VectorType>(SI->getType ())) {
641
+ #if JL_LLVM_VERSION >= 120000
642
+ ElementCount EC = VTy->getElementCount ();
643
+ Numbers.resize (EC.getKnownMinValue (), -1 );
644
+ #else
629
645
Numbers.resize (VTy->getNumElements (), -1 );
646
+ #endif
647
+ }
630
648
else
631
649
assert (isa<PointerType>(SI->getType ()) && " unimplemented" );
632
650
assert (!isTrackedValue (SI));
@@ -686,7 +704,12 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
686
704
assert (NumRoots == 1 );
687
705
int Number = Numbers[0 ];
688
706
Numbers.resize (0 );
707
+ #if JL_LLVM_VERSION >= 120000
708
+ ElementCount EC = VTy->getElementCount ();
709
+ Numbers.resize (EC.getKnownMinValue (), Number);
710
+ #else
689
711
Numbers.resize (VTy->getNumElements (), Number);
712
+ #endif
690
713
}
691
714
}
692
715
if (!isa<PointerType>(SI->getType ()))
0 commit comments