Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated VectorType::getNumElements with new APIs #41144

Merged
merged 2 commits into from
Jun 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,14 @@ CountTrackedPointers::CountTrackedPointers(Type *T) {
}
if (isa<ArrayType>(T))
count *= cast<ArrayType>(T)->getNumElements();
else if (isa<VectorType>(T))
else if (isa<VectorType>(T)) {
#if JL_LLVM_VERSION >= 120000
ElementCount EC = cast<VectorType>(T)->getElementCount();
count *= EC.getKnownMinValue();
#else
count *= cast<VectorType>(T)->getNumElements();
#endif
}
}
if (count == 0)
all = false;
Expand All @@ -408,8 +414,14 @@ unsigned getCompositeNumElements(Type *T) {
return ST->getNumElements();
else if (auto *AT = dyn_cast<ArrayType>(T))
return AT->getNumElements();
else
else {
#if JL_LLVM_VERSION >= 120000
ElementCount EC = cast<VectorType>(T)->getElementCount();
return EC.getKnownMinValue();
#else
return cast<VectorType>(T)->getNumElements();
#endif
}
}

// Walk through a Type, and record the element path to every tracked value inside
Expand Down Expand Up @@ -625,8 +637,14 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
}
std::vector<int> Numbers;
unsigned NumRoots = 1;
if (auto VTy = dyn_cast<VectorType>(SI->getType()))
if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
#if JL_LLVM_VERSION >= 120000
ElementCount EC = VTy->getElementCount();
Numbers.resize(EC.getKnownMinValue(), -1);
#else
Numbers.resize(VTy->getNumElements(), -1);
#endif
}
else
assert(isa<PointerType>(SI->getType()) && "unimplemented");
assert(!isTrackedValue(SI));
Expand Down Expand Up @@ -686,7 +704,12 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
assert(NumRoots == 1);
int Number = Numbers[0];
Numbers.resize(0);
#if JL_LLVM_VERSION >= 120000
ElementCount EC = VTy->getElementCount();
Numbers.resize(EC.getKnownMinValue(), Number);
#else
Numbers.resize(VTy->getNumElements(), Number);
#endif
}
}
if (!isa<PointerType>(SI->getType()))
Expand Down